com.jaspersoft.jasperserver.api.common.util.spring
Class EagerPropertyPlaceholderConfigurer

java.lang.Object
  extended by org.springframework.core.io.support.PropertiesLoaderSupport
      extended by org.springframework.beans.factory.config.PropertyResourceConfigurer
          extended by org.springframework.beans.factory.config.PropertyPlaceholderConfigurer
              extended by com.jaspersoft.jasperserver.api.common.util.spring.EagerPropertyPlaceholderConfigurer
All Implemented Interfaces:
org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.config.BeanFactoryPostProcessor, org.springframework.beans.factory.InitializingBean, org.springframework.core.Ordered

public class EagerPropertyPlaceholderConfigurer
extends org.springframework.beans.factory.config.PropertyPlaceholderConfigurer
implements org.springframework.beans.factory.InitializingBean

A property resource configurer that resolves placeholders in bean property values of context definitions, immediately after the bean has been initialized. It is useful to resolve bean property placeholders in other Ordered BeanFactoryPostProcessor. It must be noted that the other Ordered BeanFactoryPostProcessor must be defined after this. A caveat is that not all ListableBeanFactory implementations return bean names in the order of definition as prescribed by the interface, which is relied upon by this configurer.

Example XML context definition:

 <bean id="systemPropertiesConfigurer"
      class="au.com.cardlink.common.spring.beans.factory.config.EagerPropertyPlaceholderConfigurer">
   <property name="placeholderPrefix"><value>$${</value></property>
 </bean>
 <bean id="configPropertiesConfigurer"
      class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
   <property name="location"><value>$${config.properties.location}</value></property>
   <property name="fileEncoding"><value>$${cardlink.properties.encoding}</value></property>
 </bean>

Since:
26/07/2006
Author:
Alex Wei (ozgwei@gmail.com)
See Also:
Ordered, BeanFactoryPostProcessor, ListableBeanFactory, PropertyPlaceholderConfigurer

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.core.io.support.PropertiesLoaderSupport
logger, XML_FILE_EXTENSION
 
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
 
Constructor Summary
EagerPropertyPlaceholderConfigurer()
          Zero-argument constructor.
 
Method Summary
 void afterPropertiesSet()
          Eagerly resolves property placeholders so that the bean definitions of other BeanFactoryPostProcessor can be modified before instantiation.
 void postProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory)
          Resolves property placeholders only if the post processing was not run in afterPropertiesSet().
 void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
           
 
Methods inherited from class org.springframework.beans.factory.config.PropertyPlaceholderConfigurer
parseStringValue, processProperties, resolvePlaceholder, resolvePlaceholder, resolveSystemProperty, setBeanName, setIgnoreUnresolvablePlaceholders, setPlaceholderPrefix, setPlaceholderSuffix, setSearchSystemEnvironment, setSystemPropertiesMode, setSystemPropertiesModeName
 
Methods inherited from class org.springframework.beans.factory.config.PropertyResourceConfigurer
convertProperties, convertPropertyValue, getOrder, setOrder
 
Methods inherited from class org.springframework.core.io.support.PropertiesLoaderSupport
loadProperties, mergeProperties, setFileEncoding, setIgnoreResourceNotFound, setLocalOverride, setLocation, setLocations, setProperties, setPropertiesArray, setPropertiesPersister
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EagerPropertyPlaceholderConfigurer

public EagerPropertyPlaceholderConfigurer()
Zero-argument constructor.

Method Detail

afterPropertiesSet

public void afterPropertiesSet()
                        throws java.lang.Exception
Eagerly resolves property placeholders so that the bean definitions of other BeanFactoryPostProcessor can be modified before instantiation.

Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Throws:
java.lang.Exception

setBeanFactory

public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
Specified by:
setBeanFactory in interface org.springframework.beans.factory.BeanFactoryAware
Overrides:
setBeanFactory in class org.springframework.beans.factory.config.PropertyPlaceholderConfigurer

postProcessBeanFactory

public void postProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory)
                            throws org.springframework.beans.BeansException
Resolves property placeholders only if the post processing was not run in afterPropertiesSet().

Specified by:
postProcessBeanFactory in interface org.springframework.beans.factory.config.BeanFactoryPostProcessor
Overrides:
postProcessBeanFactory in class org.springframework.beans.factory.config.PropertyResourceConfigurer
Throws:
org.springframework.beans.BeansException


Copyright © 2007. All Rights Reserved.