- EmailEvent - Event
- EmailAppListener - Event Listener defined by implementing ApplicationListener
- EmailMethodListener - Event Listener defined by @EventListener
- EmailMethodAsyncListener - Asynchronous Event Listener defined by @EventListener + @Async
All Event Listener are listening to Email Event only. But are defined with @Order so all will execute in sequence defined in @Order.
- EmailService - Event publisher defined by implementing ApplicationEventPublisherAware. This service publishes event which is subscribed by three aforementioned listeners.
- Import project as Maven project
- Run application as Spring Boot Application
- Launch URL: "http://localhost:8080/sendEmail". This will call EmailController which calls EmailService in turn which publishes the event to send email.
- Observe log to see the sequence of event listener execution and relate it with different defined listeners