RE: proper way to call setSystemMessagesProvider ?

I’m not 100% on the correct way, but I would suggest using the following method:

[code]
@Component
public static class OwlcmsServlet
    implements VaadinServiceInitListener {

  @Override
  public void serviceInit(ServiceInitEvent event) {
    event.getSource().setSystemMessagesProvider(new I18nMessagesProvider());
  }
}
[/code]

In version 8, using Spring Boot, I used the following code like the following to set the system messages provider. What woul be the correct equivalent in version 10? This is my attempt using version 10 – servletInitialized does not get called.

@Component("vaadinServlet")
public class OwlcmsServlet extends SpringServlet {

    public OwlcmsServlet(ApplicationContext context) {
        super(context);
    }

    @Override
    protected void servletInitialized() throws ServletException {
        super.servletInitialized();
        getService().setSystemMessagesProvider(new I18nMessagesProvider());
    }
}

Checked, does not work. Under SpringBoot, this class is not found (and classes cannot be static)
Also, tried adding the setSystemMessagesProvider class to the class listed in src/main/resources/META-INF/services/com.vaadin.server.VaadinServiceInitListener as done in the beveragebuddy starter application. This does not work under SpringBoot. Indeed the documentation for the service init listener states
“Integrations for specific runtime environments, such as OSGi or Spring, might also provide other ways of discovering listeners.”

The
static
keyword is probably there just because it was copied from example code where the listener was an inner class. Otherwise, the most logical reason I can come up with for why that wouldn’t work is that the package that contains your listener implementation is not included in your
@ComponentScan
definition (or similar).

Regarding
/META-INF/services
, the problem is that the interface was recently moved to another package, but we missed to update that part of the documentation at the same time. The name of the file that lists the implementaion should nowadays be
com.vaadin.flow.server.VaadinServiceInitListener
. Sorry about that!