Package org.springframework.util
Class PropertyPlaceholderHelper
java.lang.Object
org.springframework.util.PropertyPlaceholderHelper
Utility class for working with Strings that have placeholder values in them.
 
A placeholder takes the form ${name}. Using PropertyPlaceholderHelper
 these placeholders can be substituted for user-supplied values.
 
Values for substitution can be supplied using a Properties instance or
 using a PropertyPlaceholderHelper.PlaceholderResolver.
- Since:
 - 3.0
 - Author:
 - Juergen Hoeller, Rob Harrop, Stephane Nicoll
 
- 
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceStrategy interface used to resolve replacement values for placeholders contained in Strings. - 
Constructor Summary
ConstructorsConstructorDescriptionPropertyPlaceholderHelper(String placeholderPrefix, String placeholderSuffix) Create a newPropertyPlaceholderHelperthat uses the supplied prefix and suffix.PropertyPlaceholderHelper(String placeholderPrefix, String placeholderSuffix, String valueSeparator, boolean ignoreUnresolvablePlaceholders) Deprecated, for removal: This API element is subject to removal in a future version.PropertyPlaceholderHelper(String placeholderPrefix, String placeholderSuffix, String valueSeparator, Character escapeCharacter, boolean ignoreUnresolvablePlaceholders) Create a newPropertyPlaceholderHelperthat uses the supplied prefix and suffix. - 
Method Summary
Modifier and TypeMethodDescriptionprotected StringparseStringValue(String value, PropertyPlaceholderHelper.PlaceholderResolver placeholderResolver) replacePlaceholders(String value, Properties properties) Replace all placeholders of format${name}with the corresponding property from the suppliedProperties.replacePlaceholders(String value, PropertyPlaceholderHelper.PlaceholderResolver placeholderResolver) Replace all placeholders of format${name}with the value returned from the suppliedPropertyPlaceholderHelper.PlaceholderResolver. 
- 
Constructor Details
- 
PropertyPlaceholderHelper
Create a newPropertyPlaceholderHelperthat uses the supplied prefix and suffix. Unresolvable placeholders are ignored.- Parameters:
 placeholderPrefix- the prefix that denotes the start of a placeholderplaceholderSuffix- the suffix that denotes the end of a placeholder
 - 
PropertyPlaceholderHelper
@Deprecated(since="6.2", forRemoval=true) public PropertyPlaceholderHelper(String placeholderPrefix, String placeholderSuffix, @Nullable String valueSeparator, boolean ignoreUnresolvablePlaceholders) Deprecated, for removal: This API element is subject to removal in a future version.as of 6.2, in favor ofPropertyPlaceholderHelper(String, String, String, Character, boolean)Create a newPropertyPlaceholderHelperthat uses the supplied prefix and suffix.- Parameters:
 placeholderPrefix- the prefix that denotes the start of a placeholderplaceholderSuffix- the suffix that denotes the end of a placeholdervalueSeparator- the separating character between the placeholder variable and the associated default value, if anyignoreUnresolvablePlaceholders- indicates whether unresolvable placeholders should be ignored (true) or cause an exception (false)
 - 
PropertyPlaceholderHelper
public PropertyPlaceholderHelper(String placeholderPrefix, String placeholderSuffix, @Nullable String valueSeparator, @Nullable Character escapeCharacter, boolean ignoreUnresolvablePlaceholders) Create a newPropertyPlaceholderHelperthat uses the supplied prefix and suffix.- Parameters:
 placeholderPrefix- the prefix that denotes the start of a placeholderplaceholderSuffix- the suffix that denotes the end of a placeholdervalueSeparator- the separating character between the placeholder variable and the associated default value, if anyescapeCharacter- the escape character to use to ignore placeholder prefix or value separator, if anyignoreUnresolvablePlaceholders- indicates whether unresolvable placeholders should be ignored (true) or cause an exception (false)- Since:
 - 6.2
 
 
 - 
 - 
Method Details
- 
replacePlaceholders
Replace all placeholders of format${name}with the corresponding property from the suppliedProperties.- Parameters:
 value- the value containing the placeholders to be replacedproperties- thePropertiesto use for replacement- Returns:
 - the supplied value with placeholders replaced inline
 
 - 
replacePlaceholders
public String replacePlaceholders(String value, PropertyPlaceholderHelper.PlaceholderResolver placeholderResolver) Replace all placeholders of format${name}with the value returned from the suppliedPropertyPlaceholderHelper.PlaceholderResolver.- Parameters:
 value- the value containing the placeholders to be replacedplaceholderResolver- thePlaceholderResolverto use for replacement- Returns:
 - the supplied value with placeholders replaced inline
 
 - 
parseStringValue
protected String parseStringValue(String value, PropertyPlaceholderHelper.PlaceholderResolver placeholderResolver)  
 - 
 
PropertyPlaceholderHelper(String, String, String, Character, boolean)