org.onebusaway.container.spring
Class OverridePostProcessor

java.lang.Object
  extended by org.onebusaway.container.spring.OverridePostProcessor
All Implemented Interfaces:
org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.config.BeanPostProcessor, org.springframework.core.Ordered, org.springframework.core.PriorityOrdered

public class OverridePostProcessor
extends Object
implements org.springframework.beans.factory.config.BeanPostProcessor, org.springframework.core.PriorityOrdered, org.springframework.beans.factory.BeanFactoryAware

A link BeanPostProcessor that allows one to set and override bean properties in a flexible ways before the bean is initialized. This is similar to the functionality of PropertyOverrideConfigurer, except that it is a Spring bean post processor as opposed to a factory bean, which determines execution order in the application context construction lifecycle and allows one to use bean references for overriding bean properties as opposed to just string values. A simple example:

<bean class="org.onebusaway.container.spring.OverridePostProcessor">
   <property name="map">
     <map>
       <entry key="beanName.beanProperty" value ="someOtherBeanName" />
     </map>
   </property>
 </bean>

Author:
bdferris

Field Summary
 
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
 
Constructor Summary
OverridePostProcessor()
           
 
Method Summary
 int getOrder()
           
 Object postProcessAfterInitialization(Object bean, String beanName)
           
 Object postProcessBeforeInitialization(Object bean, String beanName)
           
 void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
           
 void setMap(Map<String,String> map)
           
 void setOrder(int order)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OverridePostProcessor

public OverridePostProcessor()
Method Detail

setMap

public void setMap(Map<String,String> map)

setOrder

public void setOrder(int order)

getOrder

public int getOrder()
Specified by:
getOrder in interface org.springframework.core.Ordered

setBeanFactory

public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
                    throws org.springframework.beans.BeansException
Specified by:
setBeanFactory in interface org.springframework.beans.factory.BeanFactoryAware
Throws:
org.springframework.beans.BeansException

postProcessBeforeInitialization

public Object postProcessBeforeInitialization(Object bean,
                                              String beanName)
                                       throws org.springframework.beans.BeansException
Specified by:
postProcessBeforeInitialization in interface org.springframework.beans.factory.config.BeanPostProcessor
Throws:
org.springframework.beans.BeansException

postProcessAfterInitialization

public Object postProcessAfterInitialization(Object bean,
                                             String beanName)
                                      throws org.springframework.beans.BeansException
Specified by:
postProcessAfterInitialization in interface org.springframework.beans.factory.config.BeanPostProcessor
Throws:
org.springframework.beans.BeansException


Copyright © 2012 OneBusAway. All Rights Reserved.