AbstractBeanFactoryBasedTargetSourceCreator.java 文件源码

java
阅读 25 收藏 0 点赞 0 评论 0

项目:lams 作者:
/**
 * 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);

    // Filter out BeanPostProcessors that are part of the AOP infrastructure,
    // 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;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号