public class

PreferencesPlaceholderConfigurer

extends PropertyPlaceholderConfigurer
implements InitializingBean
java.lang.Object
   ↳ org.springframework.core.io.support.PropertiesLoaderSupport
     ↳ org.springframework.beans.factory.config.PropertyResourceConfigurer
       ↳ org.springframework.beans.factory.config.PlaceholderConfigurerSupport
         ↳ org.springframework.beans.factory.config.PropertyPlaceholderConfigurer
           ↳ org.springframework.beans.factory.config.PreferencesPlaceholderConfigurer

Class Overview

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.

See Also

Summary

[Expand]
Inherited Constants
From class org.springframework.beans.factory.config.PropertyPlaceholderConfigurer
From class org.springframework.beans.factory.config.PlaceholderConfigurerSupport
From class org.springframework.core.io.support.PropertiesLoaderSupport
From interface org.springframework.core.Ordered
[Expand]
Inherited Fields
From class org.springframework.beans.factory.config.PlaceholderConfigurerSupport
From class org.springframework.core.io.support.PropertiesLoaderSupport
Public Constructors
PreferencesPlaceholderConfigurer()
Public Methods
void afterPropertiesSet()
This implementation eagerly fetches the Preferences instances for the required system and user tree nodes.
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.
Protected Methods
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.
String resolvePlaceholder(String path, String key, Preferences preferences)
Resolve the given path and key against the given Preferences.
[Expand]
Inherited Methods
From class org.springframework.beans.factory.config.PropertyPlaceholderConfigurer
From class org.springframework.beans.factory.config.PlaceholderConfigurerSupport
From class org.springframework.beans.factory.config.PropertyResourceConfigurer
From class org.springframework.core.io.support.PropertiesLoaderSupport
From class java.lang.Object
From interface org.springframework.beans.factory.BeanFactoryAware
From interface org.springframework.beans.factory.BeanNameAware
From interface org.springframework.beans.factory.InitializingBean
From interface org.springframework.beans.factory.config.BeanFactoryPostProcessor
From interface org.springframework.core.Ordered

Public Constructors

public PreferencesPlaceholderConfigurer ()

Also: SpringBeans

Public Methods

public void afterPropertiesSet ()

Also: SpringBeans

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

public void setSystemTreePath (String systemTreePath)

Also: SpringBeans

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

public void setUserTreePath (String userTreePath)

Also: SpringBeans

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

Protected Methods

protected String resolvePlaceholder (String placeholder, Properties props)

Also: SpringBeans

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 the placeholder to resolve
props the merged properties of this configurer
Returns
  • the resolved value, of null if none

protected String resolvePlaceholder (String path, String key, Preferences preferences)

Also: SpringBeans

Resolve the given path and key against the given Preferences.

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