org.springframework.beans.factory.config
Class PreferencesPlaceholderConfigurer

java.lang.Object
  extended byorg.springframework.beans.factory.config.PropertyResourceConfigurer
      extended byorg.springframework.beans.factory.config.PropertyPlaceholderConfigurer
          extended byorg.springframework.beans.factory.config.PreferencesPlaceholderConfigurer
All Implemented Interfaces:
BeanFactoryPostProcessor, InitializingBean, Ordered

public class PreferencesPlaceholderConfigurer
extends PropertyPlaceholderConfigurer
implements InitializingBean

Subclass of PropertyPlaceholderConfigurer that supports J2SE 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. Uses the respective root nodes if not specified.

Since:
16.02.2004
Author:
Juergen Hoeller
See Also:
setSystemTreePath(java.lang.String), setUserTreePath(java.lang.String), Preferences

Field Summary
 
Fields inherited from class org.springframework.beans.factory.config.PropertyPlaceholderConfigurer
DEFAULT_PLACEHOLDER_PREFIX, DEFAULT_PLACEHOLDER_SUFFIX, SYSTEM_PROPERTIES_MODE_FALLBACK, SYSTEM_PROPERTIES_MODE_NEVER, SYSTEM_PROPERTIES_MODE_OVERRIDE
 
Fields inherited from class org.springframework.beans.factory.config.PropertyResourceConfigurer
logger
 
Constructor Summary
PreferencesPlaceholderConfigurer()
           
 
Method Summary
 void afterPropertiesSet()
          This implementation eagerly fetches the Preferences instances for the required system and user tree nodes.
protected  java.lang.String resolvePlaceholder(java.lang.String placeholder, java.util.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.
 void setSystemTreePath(java.lang.String systemTreePath)
          Set the path in the system preferences tree to use for resolving placeholders.
 void setUserTreePath(java.lang.String userTreePath)
          Set the path in the system preferences tree to use for resolving placeholders.
 
Methods inherited from class org.springframework.beans.factory.config.PropertyPlaceholderConfigurer
parseBeanDefinition, parseGenericArgumentValues, parseIndexedArgumentValues, parseList, parseMap, parsePropertyValues, parseSet, parseString, parseValue, processProperties, setIgnoreUnresolvablePlaceholders, setPlaceholderPrefix, setPlaceholderSuffix, setSystemPropertiesMode, setSystemPropertiesModeName
 
Methods inherited from class org.springframework.beans.factory.config.PropertyResourceConfigurer
getOrder, postProcessBeanFactory, setIgnoreResourceNotFound, setLocation, setLocations, setOrder, setProperties
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PreferencesPlaceholderConfigurer

public PreferencesPlaceholderConfigurer()
Method Detail

setSystemTreePath

public void setSystemTreePath(java.lang.String systemTreePath)
Set the path in the system preferences tree to use for resolving placeholders. Uses the root node by default.


setUserTreePath

public void setUserTreePath(java.lang.String userTreePath)
Set the path in the system preferences tree to use for resolving placeholders. Uses the root node by default.


afterPropertiesSet

public void afterPropertiesSet()
This implementation eagerly fetches the Preferences instances for the required system and user tree nodes.

Specified by:
afterPropertiesSet in interface InitializingBean

resolvePlaceholder

protected java.lang.String resolvePlaceholder(java.lang.String placeholder,
                                              java.util.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.

Overrides:
resolvePlaceholder in class PropertyPlaceholderConfigurer
Parameters:
placeholder - the placeholder to resolve
props - the merged properties of this configurer
Returns:
the resolved value
See Also:
PropertyPlaceholderConfigurer.setSystemPropertiesMode(int)


Copyright (C) 2003-2004 The Spring Framework Project.