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

Which Class Contains Clone Method in Java ?

What are the Different Scopes of a JSP Object ?

How Does hashCode Method Work in Java ?

How Do You Debug Code in JSP ?

What is a Livelock in Java ?