diff --git a/spring-context/src/main/java/org/springframework/context/annotation/Configuration.java b/spring-context/src/main/java/org/springframework/context/annotation/Configuration.java index 5bb16354331..abdd2a44e31 100644 --- a/spring-context/src/main/java/org/springframework/context/annotation/Configuration.java +++ b/spring-context/src/main/java/org/springframework/context/annotation/Configuration.java @@ -162,8 +162,8 @@ import org.springframework.stereotype.Component; * *
Externalized values may be injected {@code @Configuration} classes using the - * {@link Value @Value} annotation: + *
Externalized values may be injected into {@code @Configuration} classes using + * the {@link Value @Value} annotation: * *
* @Configuration @@ -178,13 +178,23 @@ import org.springframework.stereotype.Component; * } * }* - *
This approach is most useful when using Spring's + *
This approach is often used in conjunction with Spring's
* {@link org.springframework.context.support.PropertySourcesPlaceholderConfigurer
- * PropertySourcesPlaceholderConfigurer}, usually enabled via XML with
- * {@code
Notice that the {@code Environment} object is * {@link org.springframework.beans.factory.annotation.Autowired @Autowired} into the * configuration class and then used when populating the {@code TestBean} object. Given * the configuration above, a call to {@code testBean.getName()} will return "myTestBean". * - *
${...} placeholders in {@code In order to resolve ${...} placeholders in {@code 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:
*
@@ -92,7 +97,7 @@ import org.springframework.core.io.support.PropertySourceFactory;
* }
* }
*
- * Assuming that "my.placeholder" is present in one of the property sources already
+ * Assuming that "my.placeholder" is present in one of the property sources already
* registered, e.g. system properties or environment variables, the placeholder will
* be resolved to the corresponding value. If not, then "default/path" will be used as a
* default. Expressing a default value (delimited by colon ":") is optional. If no
@@ -101,10 +106,10 @@ import org.springframework.core.io.support.PropertySourceFactory;
*
* In cases where a given property key exists in more than one {@code .properties}
* file, the last {@code @PropertySource} annotation processed will 'win' and override.
*
- * For example, given two properties files {@code a.properties} and
+ * For example, given two properties files {@code a.properties} and
* {@code b.properties}, consider the following two configuration classes
* that reference them with {@code @PropertySource} annotations:
*
@@ -118,7 +123,7 @@ import org.springframework.core.io.support.PropertySourceFactory;
* public class ConfigB { }
*
*
- * The override ordering depends on the order in which these classes are registered
+ * The override ordering depends on the order in which these classes are registered
* with the application context.
*
* In the scenario above, the properties in {@code b.properties} will override any
* duplicates that exist in {@code a.properties}, because {@code ConfigB} was registered
* last.
*
@@ -150,6 +155,7 @@ import org.springframework.core.io.support.PropertySourceFactory;
* @author Chris Beams
* @author Juergen Hoeller
* @author Phillip Webb
+ * @author Sam Brannen
* @since 3.1
* @see PropertySources
* @see Configuration
diff --git a/spring-context/src/main/java/org/springframework/context/support/PropertySourcesPlaceholderConfigurer.java b/spring-context/src/main/java/org/springframework/context/support/PropertySourcesPlaceholderConfigurer.java
index 34c2dd82277..f29024378de 100644
--- a/spring-context/src/main/java/org/springframework/context/support/PropertySourcesPlaceholderConfigurer.java
+++ b/spring-context/src/main/java/org/springframework/context/support/PropertySourcesPlaceholderConfigurer.java
@@ -40,11 +40,11 @@ import org.springframework.util.StringValueResolver;
* within bean definition property values and {@code @Value} annotations against the current
* Spring {@link Environment} and its set of {@link PropertySources}.
*
- * This class is designed as a general replacement for {@code PropertyPlaceholderConfigurer}
- * introduced in Spring 3.1. It is used by default to support the {@code property-placeholder}
- * element in working against the spring-context-3.1 or higher XSD, whereas spring-context
- * versions <= 3.0 default to {@code PropertyPlaceholderConfigurer} to ensure backward
- * compatibility. See the spring-context XSD documentation for complete details.
+ * This class is designed as a general replacement for {@code PropertyPlaceholderConfigurer}.
+ * It is used by default to support the {@code property-placeholder} element in working against
+ * the spring-context-3.1 or higher XSD; whereas, spring-context versions <= 3.0 default to
+ * {@code PropertyPlaceholderConfigurer} to ensure backward compatibility. See the spring-context
+ * XSD documentation for complete details.
*
* Any local properties (e.g. those added via {@link #setProperties}, {@link #setLocations}
* et al.) are added as a {@code PropertySource}. Search precedence of local properties is
Resolving ${...} placeholders within {@code @PropertySource} resource locations
*
- * Any ${...} placeholders present in a {@code @PropertySource} {@linkplain #value()
+ * A note on property overriding with @PropertySource
*
- * In cases where a given property key exists in more than one {@code .properties}
+ *
@@ -128,7 +133,7 @@ import org.springframework.core.io.support.PropertySourceFactory;
* ctx.refresh();
*
*
- * In the scenario above, the properties in {@code b.properties} will override any
+ *