Header Ads

  • Breaking Now

    Explain typical Bean life cycle in Spring Bean Factory Container.

    The following steps talk about throw light on how a bean life cycle is inside a bean factory container:
    1. The bean's definition is found by the bean factory container from the XML file and instantiates the bean.
    2. The Spring framework populates all of the properties as specified in the bean definition using DI.
    3. If the bean implements the BeanNameAware interface, the factory calls setBeanName() passing the bean's ID.
    4. If the bean implements the BeanFactoryAware interface, the factory calls setBeanFactory(), passing an instance of itself.
    5. If there are any BeanPostProcessors associated with the bean, their postProcessBeforeInitialization() methods will be called.
    6. If an init-method is specified for the bean, it will be called.
    7. Finally, if there are any BeanPostProcessors associated with the bean, their postProcessAfterInitialization() methods will be called.

    Post Top Ad

    Post Bottom Ad