Spring内建可查找的依赖

AbstractApplicationContext 内建可查找的依赖

Bean 名称 Bean 实例 应用场景
environment Environment 对象 内部化配置以及 Profiles
systemProperties java.util.Properties 对象 Java 零碎属性
systemEnvironment java.util.Map 对象 操作系统环境变量
messageSource MessageSource 对象 国际化文案
lifecycleProcessor LifecycleProcessor 对象 Lifecycle Bean 处理器
applicationEventMulticaster ApplicationEventMulticaster 对 象 Spring 事件播送器

注解驱动 Spring 利用上下文内建可查找的依赖(局部)

Bean 名称 Bean 实例 应用场景
org.springframework.context.annotation.internalConfigurationAnnotationProcessor ConfigurationClassPostProcessor 对象 解决 Spring 配置类
org.springframework.context.annotation.internalAutowiredAnnotationProcessor AutowiredAnnotationBeanPostProcessor 对象 解决 @Autowired 以及 @Value 注解
org.springframework.context.annotation.internalCommonAnnotationProcessor CommonAnnotationBeanPostProcessor 对象 (条件激活)解决 JSR-250 注解,如 @PostConstruct 等
org.springframework.context.event.internalEventListenerProcessor EventListenerMethodProcessor 对象 解决标注 @EventListener 的Spring 事件监听办法
org.springframework.context.event.internalEventListenerFactory DefaultEventListenerFactory 对 象 @EventListener 事件监听办法适配为 ApplicationListener
  1. ConfigurationClassPostProcessor—>BeanFactoryPostProcessor Spring容器的生命周期解决,BeanFactory后置处理器
  2. AutowiredAnnotationBeanPostProcessor—>BeanPostProcessor Bean的生命周期解决,Bean的后置处理器
  3. CommonAnnotationBeanPostProcessor—>BeanPostProcessor Bean的生命周期解决,Bean的后置处理器
  4. EventListenerMethodProcessor—>BeanFactoryPostProcessor pring容器的生命周期解决,BeanFactory后置处理器
  5. DefaultEventListenerFactory—>EventListenerFactory

原文: https://rumenz.com/rumenbiji/Spring-builds-lookup.html

评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理