Configuration
Initialization
Load and process bean definitions
Metadata is collected from the source, XML, Java annotations and the bean definitions are added to the BeanFactory.
The BeanFactoryPostProcessor is invoked and it can change the definition of any bean.
BeanFactoryPostProcessor is an extension point and it’s used to apply transformations to bean definitions before objects are created. It’s used to read properties, configure custom scopes, etc.
Bean creation
Workflow
Creation |
BeanFactoryPostProcessor.postProcessBeanFactory() |
BeanPostProcessor.postProcessBeforeInitialization() |
@PostConstruct |
InitializingBean.afterPropertiesSet() |
init method |
BeanPostProcessor.postProcessor.AfterInitialization() |
Destruction |
@PreDestroy |
DisposableBean.destroy |
destroy method |