public class PropertySourcesPropertyResolver extends AbstractPropertyResolver
PropertyResolver implementation that resolves property values against
an underlying set of PropertySources.PropertySource,
PropertySources,
AbstractEnvironmentlogger| 构造器和说明 |
|---|
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 not
null. |
String |
getProperty(String key)
Return the property value associated with the given key,
or
null if the key cannot be resolved. |
<T> T |
getProperty(String key,
Class<T> targetValueType)
Return the property value associated with the given key,
or
null if the key cannot be resolved. |
protected <T> T |
getProperty(String key,
Class<T> targetValueType,
boolean resolveNestedPlaceholders) |
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 given
PropertySource, resulting in
the given value. |
convertValueIfNecessary, getConversionService, getProperty, getProperty, getRequiredProperty, getRequiredProperty, resolveNestedPlaceholders, resolvePlaceholders, resolveRequiredPlaceholders, setConversionService, setIgnoreUnresolvableNestedPlaceholders, setPlaceholderPrefix, setPlaceholderSuffix, setRequiredProperties, setValueSeparator, validateRequiredPropertiespublic PropertySourcesPropertyResolver(@Nullable PropertySources propertySources)
propertySources - the set of PropertySource objects to usepublic boolean containsProperty(String key)
PropertyResolvernull.containsProperty 在接口中 PropertyResolvercontainsProperty 在类中 AbstractPropertyResolver@Nullable public String getProperty(String key)
PropertyResolvernull if the key cannot be resolved.getProperty 在接口中 PropertyResolvergetProperty 在类中 AbstractPropertyResolverkey - the property name to resolvePropertyResolver.getProperty(String, String),
PropertyResolver.getProperty(String, Class),
PropertyResolver.getRequiredProperty(String)@Nullable public <T> T getProperty(String key, Class<T> targetValueType)
PropertyResolvernull if the key cannot be resolved.key - the property name to resolvetargetValueType - the expected type of the property valuePropertyResolver.getRequiredProperty(String, Class)@Nullable protected String getPropertyAsRawString(String key)
AbstractPropertyResolvergetPropertyAsRawString 在类中 AbstractPropertyResolverkey - the property name to resolvenull if none found@Nullable protected <T> T getProperty(String key, Class<T> targetValueType, boolean resolveNestedPlaceholders)
protected void logKeyFound(String key, PropertySource<?> propertySource, Object value)
PropertySource, 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 - the PropertySource that the key has been found invalue - the corresponding value