Search in sources :

Example 1 with AopInfrastructureBean

use of org.springframework.aop.framework.AopInfrastructureBean in project spring-framework by spring-projects.

the class AbstractBeanFactoryBasedTargetSourceCreator method buildInternalBeanFactory.

/**
	 * Build an internal BeanFactory for resolving target beans.
	 * @param containingFactory the containing BeanFactory that originally defines the beans
	 * @return an independent internal BeanFactory to hold copies of some target beans
	 */
protected DefaultListableBeanFactory buildInternalBeanFactory(ConfigurableBeanFactory containingFactory) {
    // Set parent so that references (up container hierarchies) are correctly resolved.
    DefaultListableBeanFactory internalBeanFactory = new DefaultListableBeanFactory(containingFactory);
    // Required so that all BeanPostProcessors, Scopes, etc become available.
    internalBeanFactory.copyConfigurationFrom(containingFactory);
    // since those are only meant to apply to beans defined in the original factory.
    for (Iterator<BeanPostProcessor> it = internalBeanFactory.getBeanPostProcessors().iterator(); it.hasNext(); ) {
        if (it.next() instanceof AopInfrastructureBean) {
            it.remove();
        }
    }
    return internalBeanFactory;
}
Also used : AopInfrastructureBean(org.springframework.aop.framework.AopInfrastructureBean) BeanPostProcessor(org.springframework.beans.factory.config.BeanPostProcessor) DefaultListableBeanFactory(org.springframework.beans.factory.support.DefaultListableBeanFactory)

Aggregations

AopInfrastructureBean (org.springframework.aop.framework.AopInfrastructureBean)1 BeanPostProcessor (org.springframework.beans.factory.config.BeanPostProcessor)1 DefaultListableBeanFactory (org.springframework.beans.factory.support.DefaultListableBeanFactory)1