Deploying Vaadin 10/11 via Servlet

I need to deploy my web app as a servlet to my http server. With Framework 8, this works fine (because I can specify the ui with @VaadinServletConfiguration).
Is there a way to this with Flow adn automtic routing as well?
Best regards,


So I could deploy the @Route component via servlet:

public class MyUI extends UI {

    @VaadinServletConfiguration(ui = MyUI.class, productionMode = false)
    @WebServlet(urlPatterns = "/*", name = "static-menu", asyncSupported = true,
            initParams = {
                    @WebInitParam(name = "frontend.url.es6", value = ""),
                    @WebInitParam(name = "frontend.url.es5", value = "")
    public static class MyUIServlet extends VaadinServlet {
        private static final long serialVersionUID = 1L;

        public MyUIServlet() throws Throwable {

        protected void servletInitialized() throws ServletException {
            try {
                ((RouteRegistry) getServletContext().getAttribute(RouteRegistry.class.getName())).
                        setNavigationTargets(new HashSet<Class<? extends Component>>() {{
            } catch (Throwable ex) {
                throw new ServletException(ex);

    protected void init(VaadinRequest request) {


where the MainView class as in the Vaadin examples:

public class MainView extends VerticalLayout implements RouterLayout{
    public MainView() {
        com.vaadin.flow.component.textfield.TextField textField = new TextField();

Route is stored in the ServletContext. I register my Route component direct via the servlet, when it is initialized.
Best regards, K.

I have exactly the same question and this is the only solution i can find. Is this the only way to do this? as reading the vaadin docs it suggests you shouldnt need to do this as a Ui class is not required when ising @Route