本文共 2828 字,大约阅读时间需要 9 分钟。
org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessor#postProcessBeforeInstantiation
org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessor#postProcessAfterInstantiation
org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessor#postProcessProperties
@Autowired @Resource @Value是在这里解析的 依赖注入点注入 : 是在属性填充后的 InstantiationAwareBeanPostProcessor.postProcessProperties()中完成的。 属性的依赖注入:根据feild生成一个DependencyDescriptor,然后调用resolveDenpency。 方法上的依赖注入:把每一个参数都生成一个DependencyDescriptor,然后调用resolveDenpency。
org.springframework.beans.factory.config.BeanPostProcessor#postProcessBeforeInitialization
ApplicationContextAware 是在这里执行的 @PostConstruct ,是InitDestroyAnnotationBeanPostProcessor中执行的 也是在这里执行的 @PostConstruct 优先 InitializingBean#afterPropertiesSet 执行 ,但是会晚于BeanPostProcessor执行,因为PostConstruct 是在CommonAnnotationBeanPostProcessor中解析执行的。而自定义的BeanPostProcessor 会在CommonAnnotationBeanPostProcessor前执行 InitDestroyAnnotationBeanPostProcessor 会通过反射找出所有 @PostConstruct init*** 的初始化方法和@PreDestroy destroy*** 方法,分别放到两个list中。org.springframework.beans.factory.InitializingBean#afterPropertiesSet
beandefinition设置的初始化方法在org.springframework.beans.factory.InitializingBean#afterPropertiesSet 后执行org.springframework.beans.factory.config.BeanPostProcessor#postProcessAfterInitialization
5 默认有两个Aware ApplicationContextAwareProcessor 和 ApplicationEventListenerDetector
转载地址:http://pbbnb.baihongyu.com/