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)

 

posted @ 2021-04-20 17:26  0o飞行天下o0  阅读(363)  评论(0编辑  收藏  举报