Observable Vaadin Events

The Vaadin CDI add-on publishes many Vaadin events to CDI.

It is not necessary to register a listener, using only an observer is sufficient to handle these events.

Events published to CDI include:

Warning
Whether or not ServiceDestroyEvent works with CDI during application shutdown depends on each specific implementation.

Example: Using the @Observes annotation to listen ServiceInitEvent.

Java

  1. public class BootstrapCustomizer {
  2. private void onServiceInit(@Observes
  3. ServiceInitEvent serviceInitEvent) {
  4. serviceInitEvent.addBootstrapListener(
  5. this::modifyBootstrapPage);
  6. }
  7. private void modifyBootstrapPage(
  8. BootstrapPageResponse response) {
  9. response.getDocument().body().append(
  10. "<p>By CDI add-on</p>");
  11. }
  12. }