Spring core framework provides application level event firing and event listening which is based on the standard Observer design pattern. There are built-in application events available or we can create our own custom events in spring. Here is the list of standard built-in Spring events:
ContextRefreshedEvent: Event fired when an ApplicationContext gets initialized or refreshed (refreshed via context.refresh() call).
ContextStartedEvent: This event is published when the ApplicationContext is started. Event fired when context.start() method is called.
ContextStoppedEvent: This event is published when the ApplicationContext is stopped. Event fired when context.stop() method is called.
ContextClosedEvent: This event is published when the ApplicationContext is closed. Event fired when context.close() method is called. A closed context reaches its end of life; it cannot be refreshed or restarted.
RequestHandledEvent: This event can only be used in spring MVC environment. It is called just after an HTTP request is completed.
|