1 Answer

0 votes
by
Bean life cycle is as follows:

The IoC container instantiates the bean from the bean’s definition in the XML file.

Spring then populates all of the properties using the dependency injection as specified in the bean definition.

The bean factory container calls setBeanName() which takes the bean ID and the corresponding bean has to implement BeanNameAware interface.

The factory then calls setBeanFactory() by passing an instance of itself (if BeanFactoryAware interface is implemented in the bean).

If BeanPostProcessors is associated with a bean, then the preProcessBeforeInitialization() methods are invoked.

If an init-method is specified, then it will be called.

Lastly, postProcessAfterInitialization() methods will be called if there are any BeanPostProcessors associated with the bean needs to be run post the creation.

Related questions

0 votes
asked Apr 4, 2021 in Spring by Robindeniel
0 votes
asked Apr 4, 2021 in Spring by Robindeniel
...