Class AbstractRemoveBeanPostProcessor

java.lang.Object
org.broadleafcommerce.common.extensibility.context.merge.AbstractRemoveBeanPostProcessor
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.config.BeanPostProcessor, org.springframework.context.ApplicationContextAware
Direct Known Subclasses:
EarlyStageRemoveBeanPostProcessor, LateStageRemoveBeanPostProcessor

public abstract class AbstractRemoveBeanPostProcessor extends Object implements org.springframework.beans.factory.config.BeanPostProcessor, org.springframework.context.ApplicationContextAware

Contains useful processing code for merge bean post processors. The BeanPostProcessor instances can be used to remove collection members from collections declared elsewhere. In effect, this allows an implementer to remove a bean that was declared in a collection (list, set or map) or previously merged via LateStageMergeBeanPostProcessor or EarlyStageMergeBeanPostProcessor.

This code demonstrates using one of the concrete implementations, LateStageRemoveBeanPostProcessor. The basic usage pattern is to specify the id of the member you want to remove (beanRef) and the id of the pre-existing, target collection (targetRef) that should receive the removal. The collection can be represented using ListFactoryBean, SetFactoryBean or MapFactoryBean. For MapFactoryBeans, use either the mapKey or mapKeyRef property instead to reference the map item to remove.

 
 <bean class="org.broadleafcommerce.common.extensibility.context.merge.LateStageRemoveBeanPostProcessor">
  <property name="beanRef" value="myBean"/>
  <property name="targetRef" value="targetCollection"/>
 </bean>
 
 
Author:
Jeff Fischer
See Also:
  • Field Details

    • beanRef

      protected String beanRef
    • targetRef

      protected String targetRef
    • mapKey

      protected String mapKey
    • mapKeyRef

      protected String mapKeyRef
    • applicationContext

      protected org.springframework.context.ApplicationContext applicationContext
  • Constructor Details

    • AbstractRemoveBeanPostProcessor

      public AbstractRemoveBeanPostProcessor()
  • Method Details

    • setApplicationContext

      public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException
      Specified by:
      setApplicationContext in interface org.springframework.context.ApplicationContextAware
      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
    • 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
    • getBeanRef

      public String getBeanRef()
    • setBeanRef

      public void setBeanRef(String beanRef)
    • getTargetRef

      public String getTargetRef()
    • setTargetRef

      public void setTargetRef(String targetRef)
    • getMapKey

      public String getMapKey()
    • setMapKey

      public void setMapKey(String mapKey)
    • getMapKeyRef

      public String getMapKeyRef()
    • setMapKeyRef

      public void setMapKeyRef(String mapKeyRef)