Spring 一些默认的BeanPostProcessor加载时间

专为注解方式来处理的:

在AnnotationConfigUtils的registerAnnotationConfigProcessors方法注入如下几类:
"org.springframework.context.annotation.internalConfigurationAnnotationProcessor"  ->ConfigurationClassPostProcessor

"org.springframework.context.annotation.internalAutowiredAnnotationProcessor" -> AutowiredAnnotationBeanPostProcessor

"org.springframework.context.annotation.internalRequiredAnnotationProcessor" -> RequiredAnnotationBeanPostProcessor

"org.springframework.context.annotation.internalCommonAnnotationProcessor" - >  CommonAnnotationBeanPostProcessor

"org.springframework.context.event.internalEventListenerProcessor" -> EventListenerMethodProcessor

"org.springframework.context.event.internalEventListenerFactory" ->  DefaultEventListenerFactory

 

该方法在构建AnnotatedBeanDefinitionReader 和ClassPathBeanDefinitionScanner 执行scan方法时被调用

e026b39588dde99919b897928ed0fadc4af.jpg

e97552799fd3d73199068d508beea453419.jpg

e85a8e12a7c5da10f5866a91e73d07d616e.jpg

springBoot:

AnnotationConfigApplicationContext 构造函数中初始化AnnotatedBeanDefinitionReader 和 ClassPathBeanDefinitionScanner

d41f8cbe6b175eb6ca3867db6ba026a60d9.jpg

AnnotationConfigWebApplicationContext 在loadBeanDefinitions 方法中 初始化reader、scanner。 该方法在父类AbstractRefreshableApplicationContext调用refreshBeanFactory。源头在AbstractApplicationContext的refresh()方法调用obtainFreshBeanFactory -> refreshBeanFactory.
ab99b620967bd929e02c0fda7edaed113cd.jpg

SpringApplication.run ->SpringApplication. prepareContext -> SpringApplication.load ->BeanDefinitionLoader.load -> source instanceof Package 时 会调用ClassPathBeanDefinitionScanner.scan

 

  XmlWebApplicationContext则是XmlBeanDefinitionReader.

 

 

 

转载于:https://my.oschina.net/u/3434392/blog/3070009

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值