spring bean lifecycle

spring bean lifecycle

public class AnnotationComponentBean implements InitializingBean, DisposableBean, ApplicationContextAware,BeanFactoryAware, BeanNameAware {...}

AnnotationComponentBean construct method (构造方法)
AnnotationComponentBean(BeanNameAware) setBeanName method (BeanNameAware设置BeanName)
AnnotationComponentBean(BeanFactoryAware) setBeanFactory method (BeanFactoryAware设置beanFactory)


AnnotationComponentBean(ApplicationContextAware) setApplicationContext method (ApplicationContextAware设置applicationContext)
CustomBeanPostProcessor(BeanPostProcessor) postProcessBeforeInitialization method.
AnnotationComponentBean postConstruct method (@PostConstruct注解 postConstruct)
AnnotationComponentBean(InitializingBean) afterPropertiesSet method (InitializingBean的afterPropertiesSet)
AnnotationComponentBean custom initMethod (自定义initMethod)
AnnotationComponentBean(BeanPostProcessor) postProcessAfterInitialization method.

bean准备就绪

AnnotationComponentBean preDestroy method (@PreDestroy preDestroy)
AnnotationComponentBean(DisposableBean) destroy method (DisposableBean destroy)
AnnotationComponentBean custom destroyMethod (自定义destroyMethod)