Skip to content

Commit 690d33e

Browse files
committed
Update @propertysource Javadoc re: ${...} placeholders
Issue: SPR-8539
1 parent 312b1aa commit 690d33e

File tree

1 file changed

+11
-1
lines changed
  • org.springframework.context/src/main/java/org/springframework/context/annotation

1 file changed

+11
-1
lines changed

org.springframework.context/src/main/java/org/springframework/context/annotation/PropertySource.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,17 @@
5454
* configuration class and then used when populating the {@code TestBean} object. Given
5555
* the configuration above, a call to {@code testBean.getName()} will return "myTestBean".
5656
*
57-
* <h3>Resolving placeholders within @PropertySource resource locations</h3>
57+
* <h3>Resolving ${...} placeholders in {@code <bean>} and {@code @Value} annotations</h3>
58+
* In order to resolve ${...} placeholders in {@code <bean>} definitions or {@code @Value}
59+
* annotations using properties from a {@code PropertySource}, one must register
60+
* a {@code PropertySourcesPlaceholderConfigurer}. This happens automatically when using
61+
* {@code <context:property-placeholder>} in XML, but must be explicitly registered using
62+
* a {@code static} {@code @Bean} method when using {@code @Configuration} classes. See
63+
* the "Working with externalized values" section of @{@link Configuration} Javadoc and
64+
* "a note on BeanFactoryPostProcessor-returning @Bean methods" of @{@link Bean} Javadoc
65+
* for details and examples.
66+
*
67+
* <h3>Resolving ${...} placeholders within {@code @PropertySource} resource locations</h3>
5868
* Any ${...} placeholders present in a {@code @PropertySource} {@linkplain #value()
5969
* resource location} will be resolved against the set of property sources already
6070
* registered against the environment. For example:

0 commit comments

Comments
 (0)