Observable Vaadin Events
The Vaadin CDI add-on publishes many Vaadin events to CDI.
It isn’t necessary to register a listener. It’s sufficient to handle these events using only an observer.
Events published to CDI include:
- 
ServiceInitEventSee VaadinServiceInitListener for more.
- 
PollEvent.
- 
BeforeEnterEvent. See Navigation Lifecycle for more.
- 
BeforeLeaveEvent. See Navigation Lifecycle for more.
- 
AfterNavigationEvent. See Navigation Lifecycle for more.
- 
UIInitEvent. See Session and UI InitListener for more.
- 
SessionInitEvent. See Handling Session Initialization and Destruction for more.
- 
SessionDestroyEvent. See Handling Session Initialization and Destruction for more.
- 
ServiceDestroyEvent.
| Warning | ServiceDestroyEventsupport during application shutdown depends on each specific implementation. | 
Example: Using the @Observes annotation to listen to ServiceInitEvent.
Source code
Java
public class BootstrapCustomizer {
    private void onServiceInit(@Observes
            ServiceInitEvent serviceInitEvent) {
        serviceInitEvent.addIndexHtmlRequestListener(
                this::modifyBootstrapPage);
    }
    private void modifyBootstrapPage(
            IndexHtmlResponse response) {
        response.getDocument().body().append(
                "<p>By CDI add-on</p>");
    }
}DD8861A6-C281-4A3D-977D-FA750E3BAB5E