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;
}
Aggregations