Top Description Methods
org.springframework.core.env

public Interface ConfigurablePropertyResolver

extends PropertyResolver
Known Direct Subinterfaces
org.springframework.core.env.ConfigurableEnvironment
Known Direct Implementers
org.springframework.core.env.AbstractPropertyResolver
Imports
org.springframework.core.convert.support.ConfigurableConversionService, org.springframework.lang.Nullable

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.
Author
Chris Beams
Since
3.1

Method Summary

Modifier and TypeMethod and Description
public ConfigurableConversionService
getConversionService()

Return the ConfigurableConversionService used when performing type conversions on properties.

public void
setConversionService(ConfigurableConversionService conversionService)

Set the ConfigurableConversionService to be used when performing type conversions on properties.

public void
setIgnoreUnresolvableNestedPlaceholders(boolean ignoreUnresolvableNestedPlaceholders)

Set whether to throw an exception when encountering an unresolvable placeholder nested within the value of a given property.

public void
setPlaceholderPrefix(String placeholderPrefix)

Set the prefix that placeholders replaced by this resolver must begin with.

public void
setPlaceholderSuffix(String placeholderSuffix)

Set the suffix that placeholders replaced by this resolver must end with.

public void
setRequiredProperties(String... requiredProperties)

Specify which properties must be present, to be verified by validateRequiredProperties().

public void
setValueSeparator(String valueSeparator)

Specify the separating character between the placeholders replaced by this resolver and their associated default value, or null if no such special character should be processed as a value separator.

public void
validateRequiredProperties()

Validate that each of the properties specified by setRequiredProperties is present and resolves to a non-null value.

Inherited from org.springframework.core.env.PropertyResolver:
containsPropertygetPropertygetPropertygetPropertygetPropertygetRequiredPropertygetRequiredPropertyresolvePlaceholdersresolveRequiredPlaceholders

Method Detail

getConversionServiceback to summary
public 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), org.springframework.core.convert.converter.ConverterRegistry#addConverter
setConversionServiceback to summary
public 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(), org.springframework.core.convert.converter.ConverterRegistry#addConverter
setIgnoreUnresolvableNestedPlaceholdersback to summary
public void setIgnoreUnresolvableNestedPlaceholders(boolean ignoreUnresolvableNestedPlaceholders)

Set 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 getProperty(String) and its variants must inspect the value set here to determine correct behavior when property values contain unresolvable placeholders.

Since
3.2
setPlaceholderPrefixback to summary
public void setPlaceholderPrefix(String placeholderPrefix)

Set the prefix that placeholders replaced by this resolver must begin with.

setPlaceholderSuffixback to summary
public void setPlaceholderSuffix(String placeholderSuffix)

Set the suffix that placeholders replaced by this resolver must end with.

setRequiredPropertiesback to summary
public void setRequiredProperties(String... requiredProperties)

Specify which properties must be present, to be verified by validateRequiredProperties().

setValueSeparatorback to summary
public void setValueSeparator(String valueSeparator)

Specify the separating character between the placeholders replaced by this resolver and their associated default value, or null if no such special character should be processed as a value separator.

validateRequiredPropertiesback to summary
public void validateRequiredProperties() throws MissingRequiredPropertiesException

Validate that each of the properties specified by setRequiredProperties is present and resolves to a non-null value.

Exceptions
MissingRequiredPropertiesException:
if any of the required properties are not resolvable.