Listen to router changes globally


we’re using Spring Boot with Vaadin and I’d like to listen to the BeforeEnterObserver event globally (not specific to a component). What’s the best way to achieve this?

You can register BeforeEnterListener on UI level

Sorry I’m relatively new to Vaadin. How to do this? Is it something for the VaadinServiceInitListener?

Correct in there you can call:

.addUIInitListener(uiInitEvent → uiInitEvent.getUI()