setting productionMode=true in Vaadin 10 Flow using @Route


I have the following setup with Vaadin 10 using the Route API

@Route(value=“rbkc”, layout = LaunchLayout.class)
public class RBKCLaunch extends VerticalLayout implements HasUrlParameter {


I access my application using http://localhost/rbkc and all works fine. I have not set up anything to do with VaadinServlet so I am assuming all that is happening under the hood.

How do I set productionMode=true in this situation?
All the documentation talks about using the @WebServlet or @VaadinServletConfiguration but I am not sure where to put this.

I have tried the following but it doesn’t work.

@Route(value=“rbkc”, layout = LaunchLayout.class)
@VaadinServletConfiguration(productionMode = true, closeIdleSessions=true)
public class RBKCLaunch extends VerticalLayout implements HasUrlParameter {

Any help appreciated.

Thanks, John.

I did the following and it did what I wanted.

I created a new class in my application as follows:

@WebServlet(urlPatterns = "/*", name = "testlaunch", asyncSupported = false,
initParams = {
        @WebInitParam(name = "productionMode", value = "true"),
        @WebInitParam(name = "heartbeatInterval", value = "-1"),
        @WebInitParam(name = "closeIdleSessions", value = "true") })

public class LaunchServlet extends VaadinServlet {
    private final Logger mLogger = LogManager.getLogger(LaunchServlet.class);
    protected void servletInitialized() throws ServletException {
        super.servletInitialized();"In LaunchServlet ... servletInitialized()");

The servlet class does nothing except set the init parameters.

I just rebuilt my application with this class in war file and it sets these parameters.

I also had to set a maven goal in the build configuration in Eclipse to do all the other stuff required for a Vaadin 10 production build.

package -PproductionMode