Package org.springframework.core.env

# Interface ConfigurablePropertyResolver

All Superinterfaces:
  `PropertyResolver`

All Known Subinterfaces:
  `ConfigurableEnvironment`

All Known Implementing Classes:
  `AbstractEnvironment`, `AbstractPropertyResolver`, `PropertySourcesPropertyResolver`, `StandardEnvironment`

public interface ConfigurablePropertyResolver extends PropertyResolver
Configuration interface to be implemented by most if not all `PropertyResolver` types. Provides facilities for accessing and customizing the `ConversionService` used when converting property values from one type to another.

Since:
  3.1
Author:
  Chris Beams, Stephane Nicoll

## Method Summary

Modifier and Type
Method
Description
`ConfigurableConversionService`
`getConversionService()`
Return the `ConfigurableConversionService` used when performing type conversions on properties.
`void`
`setConversionService(ConfigurableConversionService conversionService)`
Set the `ConfigurableConversionService` to be used when performing type conversions on properties.
`void`
`setEscapeCharacter(Character escapeCharacter)`
Set the escape character to use to ignore the placeholder prefix and the value separator, or `null` if no escaping should take place.
`void`
`setIgnoreUnresolvableNestedPlaceholders(boolean ignoreUnresolvableNestedPlaceholders)`
Specify whether to throw an exception when encountering an unresolvable placeholder nested within the value of a given property.
`void`
`setPlaceholderPrefix(String placeholderPrefix)`
Set the prefix that placeholders replaced by this resolver must begin with.
`void`
`setPlaceholderSuffix(String placeholderSuffix)`
Set the suffix that placeholders replaced by this resolver must end with.
`void`
`setRequiredProperties(String... requiredProperties)`
Specify which properties must be present, to be verified by `validateRequiredProperties()`.
`void`
`setValueSeparator(String valueSeparator)`
Set the separating character to be honored between placeholders replaced by this resolver and their associated default values, or `null` if no such special character should be processed as a value separator.
`void`
`validateRequiredProperties()`
Validate that each of the properties specified by `setRequiredProperties(java.lang.String...)` is present and resolves to a non-`null` value.

### Methods inherited from interface org.springframework.core.env.PropertyResolver

`containsProperty, getProperty, getProperty, getProperty, getProperty, getRequiredProperty, getRequiredProperty, resolvePlaceholders, resolveRequiredPlaceholders`

## Method Details

### getConversionService

ConfigurableConversionService getConversionService()
Return the `ConfigurableConversionService` used when performing type conversions on properties.

The configurable nature of the returned conversion service allows for the convenient addition and removal of individual `Converter` instances:

     ConfigurableConversionService cs = env.getConversionService();
     cs.addConverter(new FooConverter());

See Also:
  - `PropertyResolver.getProperty(String, Class)`
  - `ConverterRegistry.addConverter(org.springframework.core.convert.converter.Converter<?, ?>)`

### setConversionService

void setConversionService(ConfigurableConversionService conversionService)
Set the `ConfigurableConversionService` to be used when performing type conversions on properties.

Note: as an alternative to fully replacing the `ConversionService`, consider adding or removing individual `Converter` instances by drilling into `getConversionService()` and calling methods such as `#addConverter`.

See Also:
  - `PropertyResolver.getProperty(String, Class)`
  - `getConversionService()`
  - `ConverterRegistry.addConverter(org.springframework.core.convert.converter.Converter<?, ?>)`

### setPlaceholderPrefix

void setPlaceholderPrefix(String placeholderPrefix)
Set the prefix that placeholders replaced by this resolver must begin with.

### setPlaceholderSuffix

void setPlaceholderSuffix(String placeholderSuffix)
Set the suffix that placeholders replaced by this resolver must end with.

### setValueSeparator

void setValueSeparator(@Nullable String valueSeparator)
Set the separating character to be honored between placeholders replaced by this resolver and their associated default values, or `null` if no such special character should be processed as a value separator.

### setEscapeCharacter

void setEscapeCharacter(@Nullable Character escapeCharacter)
Set the escape character to use to ignore the placeholder prefix and the value separator, or `null` if no escaping should take place.

Since:
  6.2

### setIgnoreUnresolvableNestedPlaceholders

void setIgnoreUnresolvableNestedPlaceholders(boolean ignoreUnresolvableNestedPlaceholders)
Specify whether to throw an exception when encountering an unresolvable placeholder nested within the value of a given property. A `false` value indicates strict resolution, i.e. that an exception will be thrown. A `true` value indicates that unresolvable nested placeholders should be passed through in their unresolved ${...} form.

Implementations of `PropertyResolver.getProperty(String)` and its variants must inspect the value set here to determine correct behavior when property values contain unresolvable placeholders.

Since:
  3.2

### setRequiredProperties

void setRequiredProperties(String... requiredProperties)
Specify which properties must be present, to be verified by `validateRequiredProperties()`.

### validateRequiredProperties

void validateRequiredProperties() throws MissingRequiredPropertiesException
Validate that each of the properties specified by `setRequiredProperties(java.lang.String...)` is present and resolves to a non-`null` value.

Throws:
  `MissingRequiredPropertiesException` - if any of the required properties are not resolvable