Vaadin 7 Production Mode

In a normal environment you would have at least 2 environments to deploy your Vaadin application to, your own development environment and the production environment. Vaadin offers a production mode where things are optimized for performance. In production mode the debug window cannot be enabled via the url, Parameter debug=true.

Enable Production Mode


You can annotate your servlet with the following code to set the productionMode to true (or false).

@VaadinServletConfiguration(productionMode = true, ui = DemoUi.class)

WAR File - web.xml

Normally the production mode is set via the web.xml file in the web application archive.

    <description>Vaadin production mode</description>

The con side of this approach is that regardless of the environment the production mode is always the same as declared in the web.xml file.

VM Argument

Vaadin supports setting the production mode via a VM argument. The naming of the argument is as follows:

<vaadin servlet base package name>.productionMode=true|false

If the default VaadinServlet (package com.vaadin.server) class is used the argument must be


If a custom VaadinServlet class is declared in the web.xml file the package name of the custom class must be used.

Programmatically Settings

If the above described ways to the set the production mode don't suffice then there is also the option to set the production mode programmatically, f. e. based on a JNDI resource value.

For this a custom VaadinServlet must be created and specified in the web.xml file. In the CustomVaadinServlet class the method createDeploymentConfiguration must be overridden.

public class CustomVaadinServlet extends VaadinServlet {

    protected DeploymentConfiguration createDeploymentConfiguration(Properties initParameters) {
        Boolean prodMode = getProductionMode();
        initParameters.setProperty("productionMode", prodMode.toString());
        DeploymentConfiguration configuration = super.createDeploymentConfiguration(initParameters);
        // don't add init parm productionMode after construction because productionMode in 
        // deployment configuration has already been evaluated and is only evaluated in constructor
        return configuration;

    private Boolean getProductionMode() {
        boolean prodMode;
        return prodMode;

The super call to the method will return an object of the class DefaultDeploymentConfiguration which supports checking the system properties of the JVM and the application provided values for the production mode.