文章目录
- 如何解析@Component,@Service,@Configurationd,@Bean,@Import等注解
- [1. 源码描述](#1. 源码描述)
- [2. 类继承结构图](#2. 类继承结构图)
- [3. 解析流程](#3. 解析流程)
- [4. 具体的注解解析](#4. 具体的注解解析)
如何解析@Component,@Service,@Configurationd,@Bean,@Import等注解
1. 源码描述
BeanFactoryPostProcessor used for bootstrapping processing of @Configuration classes.
Registered by default when using context:annotation-config/ or context:component-scan/. Otherwise, may be declared manually as with any other BeanFactoryPostProcessor.
This post processor is priority-ordered as it is important that any Bean methods declared in @Configuration classes have their corresponding bean definitions registered before any other BeanFactoryPostProcessor executes.
主要是来解析@Configuration注解的类,比其他BeanFactoryPostProcessor优先执行。
2. 类继承结构图

3. 解析流程

4. 具体的注解解析
- 递归处理成员嵌套类
- @PropertySource
- @ComponentScan
- @Import
- @ImportSource
- @Bean
- 解析父类