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 is a WeakHashMap in Java ?

What is the Use of Run Time Polymorphism in Java ?

What is the Difference Between remove Methods of Collection and I ...

Why Did Oracle Release a New Version of Java Like Java 8 ?

What is the Purpose of Properties File in Java ?