Package org.springframework.core.env

# Class PropertySourcesPropertyResolver

java.lang.Object
org.springframework.core.env.AbstractPropertyResolver
org.springframework.core.env.PropertySourcesPropertyResolver

All Implemented Interfaces:
  `ConfigurablePropertyResolver`, `PropertyResolver`

public class PropertySourcesPropertyResolver extends AbstractPropertyResolver
`PropertyResolver` implementation that resolves property values against an underlying set of `PropertySources`.

Since:
  3.1
Author:
  Chris Beams, Juergen Hoeller
See Also:
  - `PropertySource`
  - `PropertySources`
  - `AbstractEnvironment`

## Field Summary

### Fields inherited from class org.springframework.core.env.AbstractPropertyResolver

`DEFAULT_PLACEHOLDER_ESCAPE_CHARACTER_PROPERTY_NAME, logger`

## Constructor Summary

Constructors
Constructor
Description
`PropertySourcesPropertyResolver(PropertySources propertySources)`
Create a new resolver against the given property sources.

## Method Summary

Modifier and Type
Method
Description
`boolean`
`containsProperty(String key)`
Determine whether the given property key is available for resolution — for example, if the value for the given key is not `null`.
`String`
`getProperty(String key)`
Resolve the property value associated with the given key, or `null` if the key cannot be resolved.
`<T> T`
`getProperty(String key, Class<T> targetValueType)`
Resolve 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.
`protected void`
`logKeyFound(String key, PropertySource<?> propertySource, Object value)`
Log the given key as found in the given `PropertySource`, resulting in the given value.

### Methods inherited from class org.springframework.core.env.AbstractPropertyResolver

`convertValueIfNecessary, getConversionService, getDefaultEscapeCharacter, getProperty, getProperty, getRequiredProperty, getRequiredProperty, resolveNestedPlaceholders, resolvePlaceholders, resolveRequiredPlaceholders, setConversionService, setEscapeCharacter, setIgnoreUnresolvableNestedPlaceholders, setPlaceholderPrefix, setPlaceholderSuffix, setRequiredProperties, setValueSeparator, validateRequiredProperties`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### PropertySourcesPropertyResolver

public PropertySourcesPropertyResolver(@Nullable PropertySources propertySources)
Create a new resolver against the given property sources.

Parameters:
  `propertySources` - the set of `PropertySource` objects to use

## Method Details

### containsProperty

public boolean containsProperty(String key)
Description copied from interface: `PropertyResolver`
Determine whether the given property key is available for resolution — for example, if the value for the given key is not `null`.

Specified by:
  `containsProperty` in interface `PropertyResolver`
Overrides:
  `containsProperty` in class `AbstractPropertyResolver`

### getProperty

@Nullable public String getProperty(String key)
Description copied from interface: `PropertyResolver`
Resolve the property value associated with the given key, or `null` if the key cannot be resolved.

Specified by:
  `getProperty` in interface `PropertyResolver`
Overrides:
  `getProperty` in class `AbstractPropertyResolver`
Parameters:
  `key` - the property name to resolve
See Also:
  - `PropertyResolver.getProperty(String, String)`
  - `PropertyResolver.getProperty(String, Class)`
  - `PropertyResolver.getRequiredProperty(String)`

### getProperty

@Nullable public <T> T getProperty(String key, Class<T> targetValueType)
Description copied from interface: `PropertyResolver`
Resolve the property value associated with the given key, or `null` if the key cannot be resolved.

Parameters:
  `key` - the property name to resolve
  `targetValueType` - the expected type of the property value
See Also:
  - `PropertyResolver.getRequiredProperty(String, Class)`

### getPropertyAsRawString

@Nullable protected String getPropertyAsRawString(String key)
Description copied from class: `AbstractPropertyResolver`
Retrieve the specified property as a raw String, i.e. without resolution of nested placeholders.

Specified by:
  `getPropertyAsRawString` in class `AbstractPropertyResolver`
Parameters:
  `key` - the property name to resolve
Returns:
  the property value or `null` if 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 given `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.

Parameters:
  `key` - the key found
  `propertySource` - the `PropertySource` that the key has been found in
  `value` - the corresponding value
Since:
  4.3.1