From 690d33e14f0e46a181e92999f102e0f75ca2534c Mon Sep 17 00:00:00 2001 From: Chris Beams Date: Thu, 8 Dec 2011 13:46:27 +0000 Subject: [PATCH] Update @PropertySource Javadoc re: ${...} placeholders Issue: SPR-8539 --- .../context/annotation/PropertySource.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/org.springframework.context/src/main/java/org/springframework/context/annotation/PropertySource.java b/org.springframework.context/src/main/java/org/springframework/context/annotation/PropertySource.java index a928d9b672d..e67f6aab26f 100644 --- a/org.springframework.context/src/main/java/org/springframework/context/annotation/PropertySource.java +++ b/org.springframework.context/src/main/java/org/springframework/context/annotation/PropertySource.java @@ -54,7 +54,17 @@ import java.lang.annotation.Target; * configuration class and then used when populating the {@code TestBean} object. Given * the configuration above, a call to {@code testBean.getName()} will return "myTestBean". * - *

Resolving placeholders within @PropertySource resource locations

+ *

Resolving ${...} placeholders in {@code } and {@code @Value} annotations

+ * In order to resolve ${...} placeholders in {@code } definitions or {@code @Value} + * annotations using properties from a {@code PropertySource}, one must register + * a {@code PropertySourcesPlaceholderConfigurer}. This happens automatically when using + * {@code } in XML, but must be explicitly registered using + * a {@code static} {@code @Bean} method when using {@code @Configuration} classes. See + * the "Working with externalized values" section of @{@link Configuration} Javadoc and + * "a note on BeanFactoryPostProcessor-returning @Bean methods" of @{@link Bean} Javadoc + * for details and examples. + * + *

Resolving ${...} placeholders within {@code @PropertySource} resource locations

* Any ${...} placeholders present in a {@code @PropertySource} {@linkplain #value() * resource location} will be resolved against the set of property sources already * registered against the environment. For example: