提交 75f47392 编写于 作者: J Juergen Hoeller

Polishing

上级 11b4e3be
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -61,8 +61,8 @@ import java.lang.annotation.Target;
* a {@code PropertySourcesPlaceholderConfigurer}. This happens automatically when using
* {@code <context:property-placeholder>} 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
* the "Working with externalized values" section of @{@link Configuration}'s javadoc and
* "a note on BeanFactoryPostProcessor-returning @Bean methods" of @{@link Bean}'s javadoc
* for details and examples.
*
* <h3>Resolving ${...} placeholders within {@code @PropertySource} resource locations</h3>
......@@ -126,11 +126,11 @@ import java.lang.annotation.Target;
* <p>In certain situations, it may not be possible or practical to tightly control
* property source ordering when using {@code @ProperySource} annotations. For example,
* if the {@code @Configuration} classes above were registered via component-scanning,
* the ordering is difficult to predict. In such cases - and if overriding is important -
* the ordering is difficult to predict. In such cases - and if overriding is important -
* it is recommended that the user fall back to using the programmatic PropertySource API.
* See {@link org.springframework.core.env.ConfigurableEnvironment ConfigurableEnvironment}
* and {@link org.springframework.core.env.MutablePropertySources MutablePropertySources}
* Javadoc for details.
* javadocs for details.
*
* @author Chris Beams
* @author Phillip Webb
......@@ -160,11 +160,11 @@ public @interface PropertySource {
* Indicate the resource location(s) of the properties file to be loaded.
* For example, {@code "classpath:/com/myco/app.properties"} or
* {@code "file:/path/to/file"}.
* <p>Resource location wildcards (e.g. *&#42;/*.properties) are not permitted; each
* location must evaluate to exactly one {@code .properties} resource.
* <p>Resource location wildcards (e.g. *&#42;/*.properties) are not permitted;
* each location must evaluate to exactly one {@code .properties} resource.
* <p>${...} placeholders will be resolved against any/all property sources already
* registered with the {@code Environment}. See {@linkplain PropertySource above} for
* examples.
* registered with the {@code Environment}. See {@linkplain PropertySource above}
* for examples.
* <p>Each location will be added to the enclosing {@code Environment} as its own
* property source, and in the order declared.
*/
......
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -35,26 +35,24 @@ import org.springframework.util.Assert;
import org.springframework.util.StringValueResolver;
/**
* Specialization of {@link org.springframework.beans.factory.config.PlaceholderConfigurerSupport
* PlaceholderConfigurerSupport} that resolves ${...} placeholders within bean definition
* property values and {@code @Value} annotations against the current Spring {@link
* Environment} and its set of {@link PropertySources}.
* Specialization of {@link PlaceholderConfigurerSupport} that resolves ${...} placeholders
* within bean definition property values and {@code @Value} annotations against the current
* Spring {@link Environment} and its set of {@link PropertySources}.
*
* <p>This class is designed as a general replacement for {@code
* PropertyPlaceholderConfigurer} in Spring 3.1 applications. It is used by default to
* support the {@code property-placeholder} element in working against the
* spring-context-3.1 XSD, whereas spring-context versions &lt;= 3.0 default to
* {@code PropertyPlaceholderConfigurer} to ensure backward compatibility. See
* spring-context XSD documentation for complete details.
* <p>This class is designed as a general replacement for {@code PropertyPlaceholderConfigurer}
* in Spring 3.1 applications. It is used by default to support the {@code property-placeholder}
* element in working against the spring-context-3.1 XSD, whereas spring-context versions
* &lt;= 3.0 default to {@code PropertyPlaceholderConfigurer} to ensure backward compatibility.
* See the spring-context XSD documentation for complete details.
*
* <p>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 based on the value of the {@link #setLocalOverride localOverride}
* property, which is by default {@code false} meaning that local properties are to be
* searched last, after all environment property sources.
* <p>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
* based on the value of the {@link #setLocalOverride localOverride} property, which is by
* default {@code false} meaning that local properties are to be searched last, after all
* environment property sources.
*
* <p>See {@link org.springframework.core.env.ConfigurableEnvironment ConfigurableEnvironment}
* and related Javadoc for details on manipulating environment property sources.
* and related javadocs for details on manipulating environment property sources.
*
* @author Chris Beams
* @since 3.1
......@@ -62,8 +60,7 @@ import org.springframework.util.StringValueResolver;
* @see org.springframework.beans.factory.config.PlaceholderConfigurerSupport
* @see org.springframework.beans.factory.config.PropertyPlaceholderConfigurer
*/
public class PropertySourcesPlaceholderConfigurer extends PlaceholderConfigurerSupport
implements EnvironmentAware {
public class PropertySourcesPlaceholderConfigurer extends PlaceholderConfigurerSupport implements EnvironmentAware {
/**
* {@value} is the name given to the {@link PropertySource} for the set of
......@@ -139,7 +136,7 @@ public class PropertySourcesPlaceholderConfigurer extends PlaceholderConfigurerS
}
try {
PropertySource<?> localPropertySource =
new PropertiesPropertySource(LOCAL_PROPERTIES_PROPERTY_SOURCE_NAME, mergeProperties());
new PropertiesPropertySource(LOCAL_PROPERTIES_PROPERTY_SOURCE_NAME, mergeProperties());
if (this.localOverride) {
this.propertySources.addFirst(localPropertySource);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册