2021-11-30 Spring源码:BeanDefinit

2021-11-30  本文已影响0人  归去来ming
class PostProcessorRegistrationDelegate {

    public static void invokeBeanFactoryPostProcessors(
            ConfigurableListableBeanFactory beanFactory, List<BeanFactoryPostProcessor> beanFactoryPostProcessors) {

        // Invoke BeanDefinitionRegistryPostProcessors first, if any.
        Set<String> processedBeans = new HashSet<String>();

        // 符合条件的有熟知的DefaultListableBeanFactory
        if (beanFactory instanceof BeanDefinitionRegistry) {
        
        // 省略
        }
        
        else {
            // 从原英文注释可以看出,这里是处理ApplicationContext的
            // Invoke factory processors registered with the context instance.
            invokeBeanFactoryPostProcessors(beanFactoryPostProcessors, beanFactory);
        }
        
    }
        
}
image.png

DefaultListableBeanFactory下面只有一个:


image.png

没有看到ClassPathXmlApplicationContext

Spring 5.2.9版本与4.3.18版本在此处一个不同的地方:


image.png image.png
上一篇 下一篇

猜你喜欢

热点阅读