What are the Different Types of Events Provided by Spring Framework ?

Spring framework provides following five events for Context...

ContextRefreshedEvent : Whenever ApplicationContext is initialized or refreshed, Spring publishes this event. We can also raise it by using refresh() method on ConfigurableApplicationContext interface.

ContextStartedEvent : When ApplicationContext is started using start() method on ConfigurableApplicationContext interface, ContextStartedEvent is published. We can poll database or restart any stopped application after receiving this event.

ContextStoppedEvent : Spring publishes this event when ApplicationContext is stopped using stop() method on ConfigurableApplicationContext interface. This is used for doing any cleanup work.

ContextClosedEvent : Once the ApplicationContext is closed using close() method, ContextClosedEvent is published. Once a context is closed, it is the last stage of its lifecycle. After this it cannot be refreshed or restarted.

RequestHandledEvent : This is a web specific event that informs to all beans that an HTTP request has been serviced.



You May Interest

When Will You Use Strategy Design Pattern in Java ?

Why Do We Use finalize Method in Java ?

What are the Differences Between Collection and Collections in Ja ...

How Will You Make an Object Immutable in Java ?

What are the Popular Implementations of Deque in Java ?