Wednesday, August 19, 2020

Spring Lifecycle

The three phases of lifecycle:

    1. Initialization

    - begins when the application context is created.

    - can be broken down in to further two phases

        a) BeanFactory Initialization

        b) Bean Initialization and Instantiation

    2. Use


    3. Destruction

    - begins when close is called on the application context.



Some examples of lifecycle methods:

@PostConstruct

a method which should be executed after construction of the object.


@PreDestroy

a method which should be called before marking the object for garbage collection.



No comments:

Post a Comment

Spring - AutoWiring

Spring automatically resolves the dependencies between the collaborating beans by inspecting the contents of the BeanFactory. This is called...