org.springframework.web.context.support
Class ServletContextPropertyPlaceholderConfigurer

java.lang.Object
  extended byorg.springframework.beans.factory.config.PropertyResourceConfigurer
      extended byorg.springframework.beans.factory.config.PropertyPlaceholderConfigurer
          extended byorg.springframework.web.context.support.ServletContextPropertyPlaceholderConfigurer
All Implemented Interfaces:
BeanFactoryAware, BeanFactoryPostProcessor, BeanNameAware, Ordered, ServletContextAware

public class ServletContextPropertyPlaceholderConfigurer
extends PropertyPlaceholderConfigurer
implements ServletContextAware

Subclass of PropertyPlaceholderConfigurer that falls back to ServletContext init parameters (that is, web.xml context-param entries) if a placeholder could not be resolved against the provided properties.

Can be combined with "locations" and/or "properties" values for fallback to web.xml context-params. Alternatively, can be defined without properties locations and values, to resolve all placeholders as web.xml context-params (or JVM system properties).

Since:
1.1.4
Author:
Juergen Hoeller
See Also:
PropertyResourceConfigurer.setLocations(org.springframework.core.io.Resource[]), PropertyResourceConfigurer.setProperties(java.util.Properties), PropertyPlaceholderConfigurer.setSystemPropertiesModeName(java.lang.String)

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
ServletContextPropertyPlaceholderConfigurer()
           
 
Method Summary
protected  String resolvePlaceholder(String placeholder, Properties props)
          Resolve the given placeholder using the given properties.
 void setServletContext(ServletContext servletContext)
          Set the ServletContext that this object runs in.
 
Methods inherited from class org.springframework.beans.factory.config.PropertyPlaceholderConfigurer
parseBeanDefinition, parseGenericArgumentValues, parseIndexedArgumentValues, parseList, parseMap, parsePropertyValues, parseSet, parseString, parseString, parseValue, processProperties, resolvePlaceholder, setBeanFactory, setBeanName, setIgnoreUnresolvablePlaceholders, setPlaceholderPrefix, setPlaceholderSuffix, setSystemPropertiesMode, setSystemPropertiesModeName
 
Methods inherited from class org.springframework.beans.factory.config.PropertyResourceConfigurer
convertProperties, convertPropertyValue, getOrder, postProcessBeanFactory, setFileEncoding, setIgnoreResourceNotFound, setLocation, setLocations, setOrder, setProperties, setPropertiesPersister
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServletContextPropertyPlaceholderConfigurer

public ServletContextPropertyPlaceholderConfigurer()
Method Detail

setServletContext

public void setServletContext(ServletContext servletContext)
Description copied from interface: ServletContextAware
Set the ServletContext that this object runs in.

Invoked after population of normal bean properties but before an init callback like InitializingBean's afterPropertiesSet or a custom init-method. Invoked after ApplicationContextAware's setApplicationContext.

Specified by:
setServletContext in interface ServletContextAware
Parameters:
servletContext - ServletContext object to be used by this object

resolvePlaceholder

protected String resolvePlaceholder(String placeholder,
                                    Properties props)
Description copied from class: PropertyPlaceholderConfigurer
Resolve the given placeholder using the given properties. Default implementation simply checks for a corresponding property key.

Subclasses can override this for customized placeholder-to-key mappings or custom resolution strategies, possibly just using the given properties as fallback.

Note that system properties will still be checked before respectively after this method is invoked, according to the system properties mode.

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


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