Top Description Fields Constructors Methods
org.springframework.beans.factory.config

public Class PreferencesPlaceholderConfigurer

extends PropertyPlaceholderConfigurer
implements InitializingBean
Class Inheritance
All Implemented Interfaces
org.springframework.beans.factory.InitializingBean
Annotations
@Deprecated
Imports
java.util.Properties, java.util.prefs.BackingStoreException, .Preferences, org.springframework.beans.factory.BeanDefinitionStoreException, .InitializingBean, org.springframework.lang.Nullable

Deprecated

as of 5.2, along with PropertyPlaceholderConfigurer

Subclass of PropertyPlaceholderConfigurer that supports JDK 1.4's Preferences API (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.

Author
Juergen Hoeller
Since
16.02.2004
See Also
setSystemTreePath, setUserTreePath, java.util.prefs.Preferences

Field Summary

Modifier and TypeField and Description
private Preferences
private String
private Preferences
private String
Inherited from org.springframework.beans.factory.config.PropertyPlaceholderConfigurer:
SYSTEM_PROPERTIES_MODE_FALLBACKSYSTEM_PROPERTIES_MODE_NEVERSYSTEM_PROPERTIES_MODE_OVERRIDE

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
afterPropertiesSet()

Implements org.springframework.beans.factory.InitializingBean.afterPropertiesSet.

This implementation eagerly fetches the Preferences instances for the required system and user tree nodes.

protected String
resolvePlaceholder(String
the placeholder to resolve
placeholder
,
Properties
the merged properties of this configurer
props
)

Overrides org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.resolvePlaceholder.

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

Returns:

the value for the placeholder, or null if none found
resolvePlaceholder
(String
the preferences path (placeholder part before '/')
path
,
String
the preferences key (placeholder part after '/')
key
,
Preferences
the Preferences to resolve against
preferences
)

Resolve the given path and key against the given Preferences.

public void
setSystemTreePath(String systemTreePath)

Set the path in the system preferences tree to use for resolving placeholders.

public void
setUserTreePath(String userTreePath)

Set the path in the system preferences tree to use for resolving placeholders.

Inherited from org.springframework.beans.factory.config.PropertyPlaceholderConfigurer:
processPropertiesresolvePlaceholderresolveSystemPropertysetSearchSystemEnvironmentsetSystemPropertiesModesetSystemPropertiesModeName

Field Detail

systemPrefsback to summary
private Preferences systemPrefs
systemTreePathback to summary
private String systemTreePath
Annotations
@Nullable
userPrefsback to summary
private Preferences userPrefs
userTreePathback to summary
private String userTreePath
Annotations
@Nullable

Constructor Detail

PreferencesPlaceholderConfigurerback to summary
public PreferencesPlaceholderConfigurer()

Method Detail

afterPropertiesSetback to summary
public void afterPropertiesSet()

Implements org.springframework.beans.factory.InitializingBean.afterPropertiesSet.

This implementation eagerly fetches the Preferences instances for the required system and user tree nodes.

Annotations
@Override
resolvePlaceholderback to summary
protected String resolvePlaceholder(String placeholder, Properties props)

Overrides org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.resolvePlaceholder.

This implementation tries to resolve placeholders as keys first in the user preferences, then in the system preferences, then in the passed-in properties.

Parameters
placeholder:String

Doc from org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.resolvePlaceholder.

the placeholder to resolve

props:Properties

Doc from org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.resolvePlaceholder.

the merged properties of this configurer

Returns:String

Doc from org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.resolvePlaceholder.

the resolved value, of null if none

Annotations
@Override
resolvePlaceholderback to summary
protected String resolvePlaceholder(String path, String key, Preferences preferences)

Resolve the given path and key against the given Preferences.

Parameters
path:String

the preferences path (placeholder part before '/')

key:String

the preferences key (placeholder part after '/')

preferences:Preferences

the Preferences to resolve against

Returns:String

the value for the placeholder, or null if none found

Annotations
@Nullable
setSystemTreePathback to summary
public void setSystemTreePath(String systemTreePath)

Set the path in the system preferences tree to use for resolving placeholders. Default is the root node.

setUserTreePathback to summary
public void setUserTreePath(String userTreePath)

Set the path in the system preferences tree to use for resolving placeholders. Default is the root node.