类 PropertyPlaceholderConfigurer
- java.lang.Object
- org.springframework.core.io.support.PropertiesLoaderSupport
- org.springframework.beans.factory.config.PropertyResourceConfigurer
- org.springframework.beans.factory.config.PlaceholderConfigurerSupport
- org.springframework.beans.factory.config.PropertyPlaceholderConfigurer
@Deprecated public class PropertyPlaceholderConfigurer extends PlaceholderConfigurerSupport
已过时。as of 5.2; useorg.springframework.context.support.PropertySourcesPlaceholderConfigurer
instead which is more flexible through taking advantage of theEnvironment
andPropertySource
mechanisms.PlaceholderConfigurerSupport
subclass that resolves ${...} placeholders againstlocal
properties
and/or system properties and environment variables.PropertyPlaceholderConfigurer
is still appropriate for use when:- the
spring-context
module is not available (i.e., one is using Spring'sBeanFactory
API as opposed toApplicationContext
). - existing configuration makes use of the
"systemPropertiesMode"
and/or"systemPropertiesModeName"
properties. Users are encouraged to move away from using these settings, and rather configure property source search order through the container'sEnvironment
; however, exact preservation of functionality may be maintained by continuing to usePropertyPlaceholderConfigurer
.
- 从以下版本开始:
- 02.10.2003
- 作者:
- Juergen Hoeller, Chris Beams
- 另请参阅:
setSystemPropertiesModeName(java.lang.String)
,PlaceholderConfigurerSupport
,PropertyOverrideConfigurer
- the
字段概要
字段 修饰符和类型 字段 说明 static int
SYSTEM_PROPERTIES_MODE_FALLBACK
已过时。Check system properties if not resolvable in the specified properties.static int
SYSTEM_PROPERTIES_MODE_NEVER
已过时。Never check system properties.static int
SYSTEM_PROPERTIES_MODE_OVERRIDE
已过时。Check system properties first, before trying the specified properties.从类继承的字段 org.springframework.beans.factory.config.PlaceholderConfigurerSupport
DEFAULT_PLACEHOLDER_PREFIX, DEFAULT_PLACEHOLDER_SUFFIX, DEFAULT_VALUE_SEPARATOR, ignoreUnresolvablePlaceholders, nullValue, placeholderPrefix, placeholderSuffix, trimValues, valueSeparator
从类继承的字段 org.springframework.core.io.support.PropertiesLoaderSupport
localOverride, localProperties, logger
从接口继承的字段 org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
构造器概要
构造器 构造器 说明 PropertyPlaceholderConfigurer()
已过时。
方法概要
所有方法 实例方法 具体方法 已过时的方法 修饰符和类型 方法 说明 protected void
processProperties(ConfigurableListableBeanFactory beanFactoryToProcess, Properties props)
已过时。Visit each bean definition in the given bean factory and attempt to replace ${...} property placeholders with values from the given properties.protected String
resolvePlaceholder(String placeholder, Properties props)
已过时。Resolve the given placeholder using the given properties.protected String
resolvePlaceholder(String placeholder, Properties props, int systemPropertiesMode)
已过时。Resolve the given placeholder using the given properties, performing a system properties check according to the given mode.protected String
resolveSystemProperty(String key)
已过时。Resolve the given key as JVM system property, and optionally also as system environment variable if no matching system property has been found.void
setSearchSystemEnvironment(boolean searchSystemEnvironment)
已过时。Set whether to search for a matching system environment variable if no matching system property has been found.void
setSystemPropertiesMode(int systemPropertiesMode)
已过时。Set how to check system properties: as fallback, as override, or never.void
setSystemPropertiesModeName(String constantName)
已过时。Set the system property mode by the name of the corresponding constant, e.g.从类继承的方法 org.springframework.beans.factory.config.PlaceholderConfigurerSupport
doProcessProperties, setBeanFactory, setBeanName, setIgnoreUnresolvablePlaceholders, setNullValue, setPlaceholderPrefix, setPlaceholderSuffix, setTrimValues, setValueSeparator
从类继承的方法 org.springframework.beans.factory.config.PropertyResourceConfigurer
convertProperties, convertProperty, convertPropertyValue, getOrder, postProcessBeanFactory, setOrder
从类继承的方法 org.springframework.core.io.support.PropertiesLoaderSupport
loadProperties, mergeProperties, setFileEncoding, setIgnoreResourceNotFound, setLocalOverride, setLocation, setLocations, setProperties, setPropertiesArray, setPropertiesPersister
字段详细资料
SYSTEM_PROPERTIES_MODE_NEVER
public static final int SYSTEM_PROPERTIES_MODE_NEVER
已过时。Never check system properties.- 另请参阅:
- 常量字段值
SYSTEM_PROPERTIES_MODE_FALLBACK
public static final int SYSTEM_PROPERTIES_MODE_FALLBACK
已过时。Check system properties if not resolvable in the specified properties. This is the default.- 另请参阅:
- 常量字段值
SYSTEM_PROPERTIES_MODE_OVERRIDE
public static final int SYSTEM_PROPERTIES_MODE_OVERRIDE
已过时。Check system properties first, before trying the specified properties. This allows system properties to override any other property source.- 另请参阅:
- 常量字段值
构造器详细资料
PropertyPlaceholderConfigurer
public PropertyPlaceholderConfigurer()
已过时。
方法详细资料
setSystemPropertiesModeName
public void setSystemPropertiesModeName(String constantName) throws IllegalArgumentException
已过时。Set the system property mode by the name of the corresponding constant, e.g. "SYSTEM_PROPERTIES_MODE_OVERRIDE".- 参数:
constantName
- name of the constant- 抛出:
IllegalArgumentException
- 另请参阅:
setSystemPropertiesMode(int)
setSystemPropertiesMode
public void setSystemPropertiesMode(int systemPropertiesMode)
已过时。Set how to check system properties: as fallback, as override, or never. For example, will resolve ${user.dir} to the "user.dir" system property.The default is "fallback": If not being able to resolve a placeholder with the specified properties, a system property will be tried. "override" will check for a system property first, before trying the specified properties. "never" will not check system properties at all.
setSearchSystemEnvironment
public void setSearchSystemEnvironment(boolean searchSystemEnvironment)
已过时。Set whether to search for a matching system environment variable if no matching system property has been found. Only applied when "systemPropertyMode" is active (i.e. "fallback" or "override"), right after checking JVM system properties.Default is "true". Switch this setting off to never resolve placeholders against system environment variables. Note that it is generally recommended to pass external values in as JVM system properties: This can easily be achieved in a startup script, even for existing environment variables.
resolvePlaceholder
@Nullable protected String resolvePlaceholder(String placeholder, Properties props, int systemPropertiesMode)
已过时。Resolve the given placeholder using the given properties, performing a system properties check according to the given mode.The default implementation delegates to
resolvePlaceholder (placeholder, props)
before/after the system properties check.Subclasses can override this for custom resolution strategies, including customized points for the system properties check.
- 参数:
placeholder
- the placeholder to resolveprops
- the merged properties of this configurersystemPropertiesMode
- the system properties mode, according to the constants in this class- 返回:
- the resolved value, of null if none
- 另请参阅:
setSystemPropertiesMode(int)
,System.getProperty(java.lang.String)
,resolvePlaceholder(String, java.util.Properties)
resolvePlaceholder
@Nullable protected String resolvePlaceholder(String placeholder, Properties props)
已过时。Resolve the given placeholder using the given properties. The default implementation simply checks for a corresponding property key.Subclasses can override this for customized placeholder-to-key mappings or custom resolution strategies, possibly just using the given properties as fallback.
Note that system properties will still be checked before respectively after this method is invoked, according to the system properties mode.
- 参数:
placeholder
- the placeholder to resolveprops
- the merged properties of this configurer- 返回:
- the resolved value, of
null
if none - 另请参阅:
setSystemPropertiesMode(int)
resolveSystemProperty
@Nullable protected String resolveSystemProperty(String key)
已过时。Resolve the given key as JVM system property, and optionally also as system environment variable if no matching system property has been found.- 参数:
key
- the placeholder to resolve as system property key- 返回:
- the system property value, or
null
if not found - 另请参阅:
setSearchSystemEnvironment(boolean)
,System.getProperty(String)
,System.getenv(String)
processProperties
protected void processProperties(ConfigurableListableBeanFactory beanFactoryToProcess, Properties props) throws BeansException
已过时。Visit each bean definition in the given bean factory and attempt to replace ${...} property placeholders with values from the given properties.- 指定者:
processProperties
在类中PropertyResourceConfigurer
- 参数:
beanFactoryToProcess
- the BeanFactory used by the application contextprops
- the Properties to apply- 抛出:
BeansException
- in case of errors