Springboot中@Autowared、@Resource这些注解的解析器类是何时初始化的

1、Spring源码中我已经知道的两种上下文:ClassPathXmlApplicationContext 、AnnotationConfigApplicationContext

2、ClassPathXmlApplicationContext 这种方式是在自定义标签componentScan解析结束后进行的

registerComponents(parserContext.getReaderContext(), beanDefinitions, element);

3、AnnotationConfigApplicationContext是在构造方法中调用this()

 通过reader的创建进行的

 调用registerAnnotationConfigProcessors();

 

 熟悉的感觉来了。

 

 4、springboot中是在run方法中

 

 

 

 很明显和Annotation的方式类似,在构造其中进行的相关默认解析器的生成(beandefinition)

原文地址:https://www.cnblogs.com/zxg-blog/p/14682006.html