A VaadinServiceInitListener can be used to configure RequestHandlers, BootstrapListeners and DependencyFilters.

The listener should be added to a ServiceInitEvent which is sent when a Vaadin service is initialized.

public class ApplicationServiceInitListener
        implements VaadinServiceInitListener {

    public void serviceInit(ServiceInitEvent event) {
        event.addBootstrapListener(response -> {
            // BoostrapListener to change the bootstrap page

        event.addDependencyFilter((dependencies, filterContext) -> {
            // DependencyFilter to add/remove/change dependencies sent to
            // the client
            return dependencies;

        event.addRequestHandler((session, request, response) -> {
            // RequestHandler to change how responses are handled
            return false;


This listener should be registered as a provider via Java SPI loading facility. To do this you should create META-INF/services resource directory and a provider configuration file with the name com.vaadin.flow.server.VaadinServiceInitListener. This is a text file and it should contain the fully qualified name of the ApplicationServiceInitListener class on its own line. It allows to discover the ApplicationServiceInitListener class, instantiate it and register as a service init listener for the application.

The content of the file should be like this: