类 PropertySourcesPropertyResolver
- java.lang.Object
- org.springframework.core.env.AbstractPropertyResolver
- org.springframework.core.env.PropertySourcesPropertyResolver
- 所有已实现的接口:
ConfigurablePropertyResolver,PropertyResolver
public class PropertySourcesPropertyResolver extends AbstractPropertyResolver
PropertyResolverimplementation 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.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 booleancontainsProperty(String key)Return whether the given property key is available for resolution, i.e. if the value for the given key is notnull.StringgetProperty(String key)Return the property value associated with the given key, ornullif the key cannot be resolved.<T> TgetProperty(String key, Class<T> targetValueType)Return the property value associated with the given key, ornullif the key cannot be resolved.protected <T> TgetProperty(String key, Class<T> targetValueType, boolean resolveNestedPlaceholders)protected StringgetPropertyAsRawString(String key)Retrieve the specified property as a raw String, i.e. without resolution of nested placeholders.protected voidlogKeyFound(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(@Nullable PropertySources propertySources)
Create a new resolver against the given property sources.- 参数:
propertySources- the set ofPropertySourceobjects to use
方法详细资料
containsProperty
public boolean containsProperty(String key)
从接口复制的说明:PropertyResolverReturn 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
@Nullable public String getProperty(String key)
从接口复制的说明:PropertyResolverReturn the property value associated with the given key, ornullif 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
@Nullable public <T> T getProperty(String key, Class<T> targetValueType)
从接口复制的说明:PropertyResolverReturn the property value associated with the given key, ornullif the key cannot be resolved.- 参数:
key- the property name to resolvetargetValueType- the expected type of the property value- 另请参阅:
PropertyResolver.getRequiredProperty(String, Class)
getPropertyAsRawString
@Nullable protected String getPropertyAsRawString(String key)
从类复制的说明:AbstractPropertyResolverRetrieve 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
nullif none found
getProperty
@Nullable protected <T> T getProperty(String key, Class<T> targetValueType, boolean resolveNestedPlaceholders)
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- thePropertySourcethat the key has been found invalue- the corresponding value- 从以下版本开始:
- 4.3.1