专为注解方式来处理的:spring
在AnnotationConfigUtils的registerAnnotationConfigProcessors方法注入以下几类:
"org.springframework.context.annotation.internalConfigurationAnnotationProcessor" ->ConfigurationClassPostProcessor函数
"org.springframework.context.annotation.internalAutowiredAnnotationProcessor" -> AutowiredAnnotationBeanPostProcessorui
"org.springframework.context.annotation.internalRequiredAnnotationProcessor" -> RequiredAnnotationBeanPostProcessorblog
"org.springframework.context.annotation.internalCommonAnnotationProcessor" - > CommonAnnotationBeanPostProcessorit
"org.springframework.context.event.internalEventListenerProcessor" -> EventListenerMethodProcessorio
"org.springframework.context.event.internalEventListenerFactory" -> DefaultEventListenerFactoryevent
该方法在构建AnnotatedBeanDefinitionReader 和ClassPathBeanDefinitionScanner 执行scan方法时被调用List
springBoot:sso
AnnotationConfigApplicationContext 构造函数中初始化AnnotatedBeanDefinitionReader 和 ClassPathBeanDefinitionScanner构造函数
AnnotationConfigWebApplicationContext 在loadBeanDefinitions 方法中 初始化reader、scanner。 该方法在父类AbstractRefreshableApplicationContext调用refreshBeanFactory。源头在AbstractApplicationContext的refresh()方法调用obtainFreshBeanFactory -> refreshBeanFactory.
SpringApplication.run ->SpringApplication. prepareContext -> SpringApplication.load ->BeanDefinitionLoader.load -> source instanceof Package 时 会调用ClassPathBeanDefinitionScanner.scan
XmlWebApplicationContext则是XmlBeanDefinitionReader.