07-ConfigurationClassPostProces的解析

文章目录

  • 如何解析@Component,@Service,@Configurationd,@Bean,@Import等注解
  • 1. 源码描述
  • 2. 类继承结构图
  • 3. 解析流程
  • 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. 类继承结构图

07-ConfigurationClassPostProces的解析_第1张图片

3. 解析流程

07-ConfigurationClassPostProces的解析_第2张图片

4. 具体的注解解析

  • 递归处理成员嵌套类
  • @PropertySource
  • @ComponentScan
  • @Import
  • @ImportSource
  • @Bean
  • 解析父类

你可能感兴趣的:(#,spring源码学习笔记,spring)