Spring源码解读一

本文是通过注解版的Ioc启动流程进行解读的

AnnotationConfigApplicationContext content = new AnnotationConfigApplicationContext(AppConfig.class);

一、通过AnnotationConfigApplicationContext的构造方法

二、调用AnnotationConfiguUtils工具类的方法registerAnnotationConfigProcessors初始化 内置的7个BeanFactoryPostProcesor

其中有一个ConfigurationClassPostProcessor这个类也是在这个方法里面放入BeanFactory

三、构造函数调用refresh方法里面

invokeBeanFactoryPostProcessors(beanFactory);

将调用之前的ConfigurationClassPostProcessor里面的方法完成扫包加了注解的类放到容器的map里面

发布了20 篇原创文章 · 获赞 4 · 访问量 2万+

猜你喜欢

转载自blog.csdn.net/lj872224/article/details/104193015