Spring---Bean生命周期
/** * org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory#doCreateBean * org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory#createBeanInstance 创建Bean实例 * * // Initialize the bean instance. * org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory#populateBean 填充Bean依赖 * * org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory#initializeBean 初始化Bean * * org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory#invokeAwareMethods 调用实现了Aware的方法 * * org.springframework.beans.factory.config.BeanPostProcessor#postProcessBeforeInitialization BeanPostProcessor的before,@PostConstruct执行 * * org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory#invokeInitMethods 调用init方法,包括实现了InitializingBean & 自定义的init方法 * org.springframework.beans.factory.InitializingBean#afterPropertiesSet() 实现了InitializingBean * org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory#invokeCustomInitMethod 自定义的init方法 * * org.springframework.beans.factory.config.BeanPostProcessor#postProcessAfterInitialization BeanPostProcessor的after */
@PostConstruct
调用堆栈
链路
在initializeBean过程,invokeAwareMethods后,调用BeanPostProcessor的BeforeInitialization,使用的是InitDestroyAnnotationBeanPostProcessor进行处理;