public class PropertySourcesPropertyResolver extends AbstractPropertyResolver
PropertyResolver implementation that resolves property values against
an underlying set of PropertySources.PropertySource,
PropertySources,
AbstractEnvironmentconversionService, logger| Constructor and Description |
|---|
PropertySourcesPropertyResolver(PropertySources propertySources)
Create a new resolver against the given property sources.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
containsProperty(String key)
Return whether the given property key is available for resolution, i.e.,
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) |
<T> Class<T> |
getPropertyAsClass(String key,
Class<T> targetValueType)
Convert the property value associated with the given key to a
Class
of type T or null if the key cannot be resolved. |
protected String |
getPropertyAsRawString(String key)
Retrieve the specified property as a raw String,
i.e.
|
getConversionService, getProperty, getProperty, getRequiredProperty, getRequiredProperty, resolveNestedPlaceholders, resolvePlaceholders, resolveRequiredPlaceholders, setConversionService, setIgnoreUnresolvableNestedPlaceholders, setPlaceholderPrefix, setPlaceholderSuffix, setRequiredProperties, setValueSeparator, validateRequiredPropertiespublic PropertySourcesPropertyResolver(PropertySources propertySources)
propertySources - the set of PropertySource objects to usepublic boolean containsProperty(String key)
PropertyResolvernull.public String getProperty(String key)
PropertyResolvernull
if the key cannot be resolved.key - the property name to resolvePropertyResolver.getProperty(String, String),
PropertyResolver.getProperty(String, Class),
PropertyResolver.getRequiredProperty(String)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)protected String getPropertyAsRawString(String key)
AbstractPropertyResolvergetPropertyAsRawString in class AbstractPropertyResolverkey - the property name to resolvenull if none foundprotected <T> T getProperty(String key, Class<T> targetValueType, boolean resolveNestedPlaceholders)
public <T> Class<T> getPropertyAsClass(String key, Class<T> targetValueType)
PropertyResolverClass
of type T or null if the key cannot be resolved.