public class PreferencesPlaceholderConfigurer extends PropertyPlaceholderConfigurer implements InitializingBean
java.util.prefs
).
Tries to resolve placeholders as keys first in the user preferences, then in the system preferences, then in this configurer's properties. Thus, behaves like PropertyPlaceholderConfigurer if no corresponding preferences defined.
Supports custom paths for the system and user preferences trees. Also supports custom paths specified in placeholders ("myPath/myPlaceholderKey"). Uses the respective root node if not specified.
setSystemTreePath(java.lang.String)
,
setUserTreePath(java.lang.String)
,
Preferences
SYSTEM_PROPERTIES_MODE_FALLBACK, SYSTEM_PROPERTIES_MODE_NEVER, SYSTEM_PROPERTIES_MODE_OVERRIDE
DEFAULT_PLACEHOLDER_PREFIX, DEFAULT_PLACEHOLDER_SUFFIX, DEFAULT_VALUE_SEPARATOR, ignoreUnresolvablePlaceholders, nullValue, placeholderPrefix, placeholderSuffix, trimValues, valueSeparator
localOverride, localProperties, logger
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
Constructor and Description |
---|
PreferencesPlaceholderConfigurer() |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet()
This implementation eagerly fetches the Preferences instances
for the required system and user tree nodes.
|
protected String |
resolvePlaceholder(String placeholder,
Properties props)
This implementation tries to resolve placeholders as keys first
in the user preferences, then in the system preferences, then in
the passed-in properties.
|
protected String |
resolvePlaceholder(String path,
String key,
Preferences preferences)
Resolve the given path and key against the given Preferences.
|
void |
setSystemTreePath(String systemTreePath)
Set the path in the system preferences tree to use for resolving
placeholders.
|
void |
setUserTreePath(String userTreePath)
Set the path in the system preferences tree to use for resolving
placeholders.
|
parseStringValue, processProperties, resolvePlaceholder, resolveSystemProperty, setSearchSystemEnvironment, setSystemPropertiesMode, setSystemPropertiesModeName
doProcessProperties, setBeanFactory, setBeanName, setIgnoreUnresolvablePlaceholders, setNullValue, setPlaceholderPrefix, setPlaceholderSuffix, setTrimValues, setValueSeparator
convertProperties, convertProperty, convertPropertyValue, getOrder, postProcessBeanFactory, setOrder
loadProperties, mergeProperties, setFileEncoding, setIgnoreResourceNotFound, setLocalOverride, setLocation, setLocations, setProperties, setPropertiesArray, setPropertiesPersister
public void setSystemTreePath(String systemTreePath)
public void setUserTreePath(String userTreePath)
public void afterPropertiesSet()
afterPropertiesSet
in interface InitializingBean
protected String resolvePlaceholder(String placeholder, Properties props)
resolvePlaceholder
in class PropertyPlaceholderConfigurer
placeholder
- the placeholder to resolveprops
- the merged properties of this configurernull
if nonePropertyPlaceholderConfigurer.setSystemPropertiesMode(int)
protected String resolvePlaceholder(String path, String key, Preferences preferences)
path
- the preferences path (placeholder part before '/')key
- the preferences key (placeholder part after '/')preferences
- the Preferences to resolve againstnull
if none found