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

Replacing Hashtable With ConcurrentHashMap in Java

How Strategy Design Pattern is Different From State Design Patter ...

What are the Lifecycle Methods of a JSP ?

How Stack and Heap Work in Java Multi-threading Environment ?

What are the Popular Implementations of Deque in Java ?