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

What are the Advantages of Multithreading in Java ?

What is XMLBeanFactory in Spring Framework ?

How Will You Pass Information From One JSP to Another JSP ?

What is the Difference Between StringBuffer and StringBuilder in ...

What are the Lifecycle Methods of a JSP ?