类 PropertySourcesPlaceholderConfigurer
- 所有已实现的接口:
Aware,BeanFactoryAware,BeanNameAware,BeanFactoryPostProcessor,EnvironmentAware,cn.taketoday.core.Ordered,cn.taketoday.core.PriorityOrdered
PlaceholderConfigurerSupport that resolves ${...} placeholders
within bean definition property values and @Value annotations against the current
Framework Environment and its set of PropertySources.
Any local properties (e.g. those added via PropertiesLoaderSupport.setProperties(java.util.Properties), PropertiesLoaderSupport.setLocations(cn.taketoday.core.io.Resource...)
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 ConfigurableEnvironment and related javadocs
for details on manipulating environment property sources.
- 从以下版本开始:
- 4.0 2021/12/12 14:39
- 作者:
- Chris Beams, Juergen Hoeller, Harry Yang
- 另请参阅:
-
ConfigurableEnvironmentPlaceholderConfigurerSupport
-
字段概要
字段修饰符和类型字段说明static final String"environmentProperties" is the name given to thePropertySourcethat wraps the environment supplied to this configurer.static final String"localProperties" is the name given to thePropertySourcefor the set of merged properties supplied to this configurer.从类继承的字段 cn.taketoday.beans.factory.config.PlaceholderConfigurerSupport
DEFAULT_PLACEHOLDER_PREFIX, DEFAULT_PLACEHOLDER_SUFFIX, DEFAULT_VALUE_SEPARATOR, ignoreUnresolvablePlaceholders, nullValue, placeholderPrefix, placeholderSuffix, trimValues, valueSeparator从类继承的字段 cn.taketoday.core.io.PropertiesLoaderSupport
localOverride, localProperties, logger从接口继承的字段 cn.taketoday.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明cn.taketoday.core.env.PropertySourcesReturn the property sources that were actually applied duringpost-processing.voidpostProcessBeanFactory(ConfigurableBeanFactory beanFactory) Processing occurs by replacing ${...} placeholders in bean definitions by resolving each against this configurer's set ofPropertySources, which includes: all environment property sources, if anEnvironmentis present merged local properties, if any have been specified any property sources set by callingsetPropertySources(cn.taketoday.core.env.PropertySources)protected voidprocessProperties(ConfigurableBeanFactory beanFactoryToProcess, cn.taketoday.core.env.ConfigurablePropertyResolver propertyResolver) Visit each bean definition in the given bean factory and attempt to replace ${...} property placeholders with values from the given properties.protected voidprocessProperties(ConfigurableBeanFactory beanFactory, Properties props) Implemented for compatibility withPlaceholderConfigurerSupport.voidsetEnvironment(cn.taketoday.core.env.Environment environment) PropertySourcesfrom the givenEnvironmentwill be searched when replacing ${...} placeholders.voidsetPropertySources(cn.taketoday.core.env.PropertySources propertySources) Customize the set ofPropertySourcesto be used by this configurer.从类继承的方法 cn.taketoday.beans.factory.config.PlaceholderConfigurerSupport
doProcessProperties, setBeanFactory, setBeanName, setIgnoreUnresolvablePlaceholders, setNullValue, setPlaceholderPrefix, setPlaceholderSuffix, setTrimValues, setValueSeparator从类继承的方法 cn.taketoday.beans.factory.config.PropertyResourceConfigurer
convertProperties, convertProperty, convertPropertyValue, getOrder, setOrder从类继承的方法 cn.taketoday.core.io.PropertiesLoaderSupport
loadProperties, mergeProperties, setFileEncoding, setIgnoreResourceNotFound, setLocalOverride, setLocation, setLocations, setProperties, setPropertiesArray, setPropertiesPersister
-
字段详细资料
-
LOCAL_PROPERTIES_PROPERTY_SOURCE_NAME
"localProperties" is the name given to thePropertySourcefor the set of merged properties supplied to this configurer.- 另请参阅:
-
ENVIRONMENT_PROPERTIES_PROPERTY_SOURCE_NAME
"environmentProperties" is the name given to thePropertySourcethat wraps the environment supplied to this configurer.- 另请参阅:
-
-
构造器详细资料
-
PropertySourcesPlaceholderConfigurer
public PropertySourcesPlaceholderConfigurer()
-
-
方法详细资料
-
setPropertySources
public void setPropertySources(cn.taketoday.core.env.PropertySources propertySources) Customize the set ofPropertySourcesto be used by this configurer.Setting this property indicates that environment property sources and local properties should be ignored.
-
setEnvironment
public void setEnvironment(@Nullable cn.taketoday.core.env.Environment environment) PropertySourcesfrom the givenEnvironmentwill be searched when replacing ${...} placeholders. -
postProcessBeanFactory
Processing occurs by replacing ${...} placeholders in bean definitions by resolving each against this configurer's set ofPropertySources, which includes:- all environment property sources, if an
Environmentis present - merged local properties, if any have been specified
- any property sources set by calling
setPropertySources(cn.taketoday.core.env.PropertySources)
If
setPropertySources(cn.taketoday.core.env.PropertySources)is called, environment and local properties will be ignored. This method is designed to give the user fine-grained control over property sources, and once set, the configurer makes no assumptions about adding additional sources. - all environment property sources, if an
-
processProperties
protected void processProperties(ConfigurableBeanFactory beanFactoryToProcess, cn.taketoday.core.env.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.- 抛出:
BeansException
-
processProperties
Implemented for compatibility withPlaceholderConfigurerSupport.- 指定者:
processProperties在类中PropertyResourceConfigurer- 抛出:
UnsupportedOperationException- in this implementation useprocessProperties(ConfigurableBeanFactory, ConfigurablePropertyResolver)
-
getAppliedPropertySources
public cn.taketoday.core.env.PropertySources getAppliedPropertySources() throws IllegalStateExceptionReturn the property sources that were actually applied duringpost-processing.- 返回:
- the property sources that were applied
- 抛出:
IllegalStateException- if the property sources have not yet been applied
-