类 PropertySourcesPropertyResolver
- java.lang.Object
- org.springframework.core.env.AbstractPropertyResolver
- org.springframework.core.env.PropertySourcesPropertyResolver
- 所有已实现的接口:
ConfigurablePropertyResolver
,PropertyResolver
public class PropertySourcesPropertyResolver extends AbstractPropertyResolver
PropertyResolver
implementation that resolves property values against an underlying set ofPropertySources
.- 从以下版本开始:
- 3.1
- 作者:
- Chris Beams, Juergen Hoeller
- 另请参阅:
PropertySource
,PropertySources
,AbstractEnvironment
字段概要
从类继承的字段 org.springframework.core.env.AbstractPropertyResolver
logger
构造器概要
构造器 构造器 说明 PropertySourcesPropertyResolver(PropertySources propertySources)
Create a new resolver against the given property sources.
方法概要
所有方法 实例方法 具体方法 已过时的方法 修饰符和类型 方法 说明 boolean
containsProperty(String key)
Return whether the given property key is available for resolution, i.e. if the value for the given key is notnull
.String
getProperty(String key)
Return the property value associated with the given key, ornull
if the key cannot be resolved.<T> T
getProperty(String key, Class<T> targetValueType)
Return the property value associated with the given key, ornull
if the key cannot be resolved.protected <T> T
getProperty(String key, Class<T> targetValueType, boolean resolveNestedPlaceholders)
<T> Class<T>
getPropertyAsClass(String key, Class<T> targetValueType)
已过时。protected String
getPropertyAsRawString(String key)
Retrieve the specified property as a raw String, i.e. without resolution of nested placeholders.protected void
logKeyFound(String key, PropertySource<?> propertySource, Object value)
Log the given key as found in the givenPropertySource
, resulting in the given value.从类继承的方法 org.springframework.core.env.AbstractPropertyResolver
convertValueIfNecessary, getConversionService, getProperty, getProperty, getRequiredProperty, getRequiredProperty, resolveNestedPlaceholders, resolvePlaceholders, resolveRequiredPlaceholders, setConversionService, setIgnoreUnresolvableNestedPlaceholders, setPlaceholderPrefix, setPlaceholderSuffix, setRequiredProperties, setValueSeparator, validateRequiredProperties
构造器详细资料
PropertySourcesPropertyResolver
public PropertySourcesPropertyResolver(PropertySources propertySources)
Create a new resolver against the given property sources.- 参数:
propertySources
- the set ofPropertySource
objects to use
方法详细资料
containsProperty
public boolean containsProperty(String key)
从接口复制的说明:PropertyResolver
Return whether the given property key is available for resolution, i.e. if the value for the given key is notnull
.- 指定者:
containsProperty
在接口中PropertyResolver
- 覆盖:
containsProperty
在类中AbstractPropertyResolver
getProperty
public String getProperty(String key)
从接口复制的说明:PropertyResolver
Return the property value associated with the given key, ornull
if the key cannot be resolved.- 指定者:
getProperty
在接口中PropertyResolver
- 覆盖:
getProperty
在类中AbstractPropertyResolver
- 参数:
key
- the property name to resolve- 另请参阅:
PropertyResolver.getProperty(String, String)
,PropertyResolver.getProperty(String, Class)
,PropertyResolver.getRequiredProperty(String)
getProperty
public <T> T getProperty(String key, Class<T> targetValueType)
从接口复制的说明:PropertyResolver
Return the property value associated with the given key, ornull
if the key cannot be resolved.- 参数:
key
- the property name to resolvetargetValueType
- the expected type of the property value- 另请参阅:
PropertyResolver.getRequiredProperty(String, Class)
getPropertyAsRawString
protected String getPropertyAsRawString(String key)
从类复制的说明:AbstractPropertyResolver
Retrieve the specified property as a raw String, i.e. without resolution of nested placeholders.- 指定者:
getPropertyAsRawString
在类中AbstractPropertyResolver
- 参数:
key
- the property name to resolve- 返回:
- the property value or
null
if none found
getProperty
protected <T> T getProperty(String key, Class<T> targetValueType, boolean resolveNestedPlaceholders)
getPropertyAsClass
@Deprecated public <T> Class<T> getPropertyAsClass(String key, Class<T> targetValueType)
已过时。从接口复制的说明:PropertyResolver
Convert the property value associated with the given key to aClass
of typeT
ornull
if the key cannot be resolved.
logKeyFound
protected void logKeyFound(String key, PropertySource<?> propertySource, Object value)
Log the given key as found in the givenPropertySource
, resulting in the given value.The default implementation writes a debug log message with key and source. As of 4.3.3, this does not log the value anymore in order to avoid accidental logging of sensitive settings. Subclasses may override this method to change the log level and/or log message, including the property's value if desired.
- 参数:
key
- the key foundpropertySource
- thePropertySource
that the key has been found invalue
- the corresponding value- 从以下版本开始:
- 4.3.1