PlaceholderConfigurerSupport that resolves ${...} placeholders
within bean definition property values and @Value annotations against the current
Spring Environment and its set of PropertySources.
This class is designed as a general replacement for PropertyPlaceholderConfigurer.
It is used by default to support the property-placeholder element in working against
the spring-context-3.1 or higher XSD; whereas, spring-context versions <= 3.0 default to
PropertyPlaceholderConfigurer to ensure backward compatibility. See the spring-context
XSD documentation for complete details.
Any local properties (e.g. those added via setProperties, setLocations
et al.) are added as a PropertySource. Search precedence of local properties is
based on the value of the localOverride property, which is by
default false meaning that local properties are to be searched last, after all
environment property sources.
See org. and related javadocs
for details on manipulating environment property sources.
org.springframework.core.env.ConfigurableEnvironment , org.springframework.beans.factory.config.PlaceholderConfigurerSupport , org.springframework.beans.factory.config.PropertyPlaceholderConfigurer
| Modifier and Type | Field and Description |
|---|---|
| private PropertySources | |
| private Environment | |
| public static final String | ENVIRONMENT_PROPERTIES_PROPERTY_SOURCE_NAME
environmentProperties is the name given to the |
| public static final String | LOCAL_PROPERTIES_PROPERTY_SOURCE_NAME
localProperties is the name given to the |
| private MutablePropertySources |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected ConfigurablePropertyResolver | createPropertyResolver(MutablePropertySources
the property sources to use propertySources)Create a |
| public PropertySources | Returns: the property sources that were appliedReturn the property sources that were actually applied during
|
| public void | postProcessBeanFactory(ConfigurableListableBeanFactory
the bean factory used by the application context beanFactory)Overrides org. Implements org. PropertySources, which includes:
|
| protected void | processProperties(ConfigurableListableBeanFactory beanFactoryToProcess, final ConfigurablePropertyResolver propertyResolver)
Visit each bean definition in the given bean factory and attempt to replace ${...} property placeholders with values from the given properties. |
| protected void | processProperties(ConfigurableListableBeanFactory
the BeanFactory used by the application context beanFactory, Properties the Properties to apply props)Implements abstract org.
Deprecated
in favor of
Implemented for compatibility with
processProperties(ConfigurableListableBeanFactory, ConfigurablePropertyResolver)
org..
|
| public void | setEnvironment(Environment environment)
Implements org. PropertySources from the given Environment
will be searched when replacing ${...} placeholders.
|
| public void | setPropertySources(PropertySources propertySources)
Customize the set of |
| appliedPropertySources | back to summary |
|---|---|
| private PropertySources appliedPropertySources
| |
| environment | back to summary |
|---|---|
| private Environment environment
| |
| ENVIRONMENT_PROPERTIES_PROPERTY_SOURCE_NAME | back to summary |
|---|---|
| public static final String ENVIRONMENT_PROPERTIES_PROPERTY_SOURCE_NAME environmentProperties is the name given to the | |
| LOCAL_PROPERTIES_PROPERTY_SOURCE_NAME | back to summary |
|---|---|
| public static final String LOCAL_PROPERTIES_PROPERTY_SOURCE_NAME localProperties is the name given to the | |
| propertySources | back to summary |
|---|---|
| private MutablePropertySources propertySources
| |
| PropertySourcesPlaceholderConfigurer | back to summary |
|---|---|
| public PropertySourcesPlaceholderConfigurer() | |
| createPropertyResolver | back to summary |
|---|---|
| protected ConfigurablePropertyResolver createPropertyResolver(MutablePropertySources propertySources) Create a
| |
| getAppliedPropertySources | back to summary |
|---|---|
| public PropertySources getAppliedPropertySources() throws IllegalStateException Return the property sources that were actually applied during
| |
| postProcessBeanFactory | back to summary |
|---|---|
| public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException Overrides org. Implements org. Processing occurs by replacing ${...} placeholders in bean definitions by resolving each
against this configurer's set of
If
| |
| processProperties | back to summary |
|---|---|
| protected void processProperties(ConfigurableListableBeanFactory beanFactoryToProcess, final ConfigurablePropertyResolver propertyResolver) throws BeansException Visit each bean definition in the given bean factory and attempt to replace ${...} property placeholders with values from the given properties. | |
| processProperties | back to summary |
|---|---|
| protected void processProperties(ConfigurableListableBeanFactory beanFactory, Properties props) Implements abstract org. Deprecated in favor of
Implemented for compatibility with
| |
| setEnvironment | back to summary |
|---|---|
| public void setEnvironment(Environment environment) Implements org.
| |
| setPropertySources | back to summary |
|---|---|
| public void setPropertySources(PropertySources propertySources) Customize the set of Setting this property indicates that environment property sources and local properties should be ignored.
| |