Documentation

Documentation versions (currently viewingVaadin 24)

Configuration Properties

Vaadin applications have configuration properties that change their behavior.

Vaadin applications have configuration properties that change their behavior. You can use either system properties or servlet initialization parameters to set them. See the full list of properties for details.

Tip
Spring Applications
See the Spring-specific instructions for Spring-based applications.

Using System Properties

When using Java system properties to set Vaadin application parameters, the vaadin. prefix must be specified before the parameter names. The following example shows how to set the pnpm.enable system property when executing a Maven goal from the command-line:

mvn jetty:run -Dvaadin.pnpm.enable=true

You can configure system properties for Maven plugin executions. For instance, the following example sets a Vaadin-specific system property when running the Jetty Maven plugin:

<plugin>
    <groupId>org.eclipse.jetty</groupId>
    <artifactId>jetty-maven-plugin</artifactId>
    <configuration>
        <systemProperties>
            <systemProperty>
                <name>vaadin.pushMode</name>
                <value>disabled</value>
            </systemProperty>
        </systemProperties>
    </configuration>
</plugin>

Using Servlet Initialization Parameters

Another option is to use servlet initialization parameters. You can use the Servlet 3.0 @WebServlet annotation, which requires you to configure your servlet unless you want it done automatically by Vaadin with default parameter values.

@WebServlet(urlPatterns = "/*", name = "myservlet", asyncSupported = true, loadOnStartup = 1,
    initParams = { @WebInitParam(name = "pnpm.enable", value = "true") })
public class MyServlet extends VaadinServlet {
}

Yet another approach is to use the web.xml file.

<?xml version="1.0" encoding="UTF-8"?>
<web-app
  id="WebApp_ID" version="3.0"
  xmlns="http://java.sun.com/xml/ns/j2ee"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
      http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">

  <servlet>
    <servlet-name>myservlet</servlet-name>
    <servlet-class>
        com.vaadin.flow.server.VaadinServlet
    </servlet-class>
    <load-on-startup>1</load-on-startup>

    <init-param>
      <param-name>pnpm.enable</param-name>
      <param-value>true</param-value>
    </init-param>
  </servlet>

  <servlet-mapping>
    <servlet-name>myservlet</servlet-name>
    <url-pattern>/*</url-pattern>
  </servlet-mapping>
</web-app>
Note
System properties override servlet parameters.
The system property is used when a system property and a servlet parameter have the same name.

Configuration Properties

The following list contains the properties that are defined in com.vaadin.server.DeploymentConfiguration and com.vaadin.server.Constants classes in alphabetical order.

Note
Spring Boot Applications
If you use Spring Boot, you should add the vaadin. prefix. For example, vaadin.productionMode=true.

Property Name

Description

Default Value

brotli

Decide whether pre-compressed Brotli files should be used if accepted by the browser. Brotli files are created during a production build and the property is only used in production mode. Set to false if you want to serve uncompressed static resources.

true

ci.build

Decide whether npm ci is run instead of npm i in production front-end builds. If you use pnpm, the install command is run with the --frozen-lockfile parameter. The build fails if the package.json and package-lock.json files have mismatching versions.

false

closeIdleSessions

Close the Vaadin session if no UI is active. A UI is considered active if it is open on the client-side and has any activity in addition to heartbeat requests. By default, heartbeat requests keep the Vaadin session open even when there is no user interaction. Set to true to close idle sessions. Also see heartbeatInterval below.

false

devmode.liveReload.enabled

Enable live reload. When using a server-side live reload tool, the browser is automatically refreshed after code is rebuilt on the server. Set to false to disable the automatic browser reload. This only applies to development mode.

true

devmode.optimizeBundle

Optimize front-end resource bundles. All front-end resources in the classpath are included in the generated bundle in development mode by default. When set to true, the front-end build creates an optimized bundle by including only front-end resources that are used from the application entry points. Note that it uses bytecode scanning, which increases application start-up time. Set to false to skip the optimization in production mode.

false

devmode.sessionSerialization.enabled

Enable session serialization. When session serialization is enabled, UI instances and registered StreamResource instances are serialized or deserialized when restarting the development server. When set to true, for example, access control information can be preserved during development so that you don’t need to log in again for each change. This only applies to development mode.

false

devmode.usageStatistics.enabled

Enable Vaadin to collect usage statistics that are used to guide further development. Statistics are collected based on features that are used in the application. No data is collected in production mode. Some usage statistics are collected through the web browser. See the client-side collector repository for instructions on how to opt out. This only applies to development mode.

true

disable.automatic.servlet.registration

Disable automatic servlet registration required by Vaadin applications. You must register Vaadin servlets yourself if set to true.

false

disable-xsrf-protection

Disable cross-site request forgery protection. The protection is enabled by default and you should keep it enabled unless for certain types of testing.

false

eagerServerLoad

Enable the client-side bootstrap page to include the initial JSON data fragment.

false

frontend.hotdeploy

Enable development using the front-end development server instead of an application bundle. This only applies to development mode.

false

heartbeatInterval

Set the heartbeat interval time. UIs that are open on the client-side send a regular heartbeat to the server indicating that they are still active even without ongoing user interaction. When the server doesn’t receive a valid heartbeat from a given UI within a certain amount of time, it removes that UI from the session. The interval value is expressed in seconds. See also closeIdleSessions.

300 seconds (5 minutes)

i18n.provider

Set the fully-qualified name for the internationalization provider class. To translate strings for localization, the application should implement the I18NProvider interface and define the class name in the i18n.provider property. See the Localization documentation for details.

null

maxMessageSuspendTimeout

Set the maximum time in milliseconds that the client waits for predecessors of an out-of-sequence message before considering them missing and requesting a full state resynchronization from the server. For example, when the server sends adjacent XmlHttpRequest responses and pushes messages over a low-bandwidth connection, the client may receive the messages out of sequence. Increase this value if your application experiences excessive resynchronization requests. However, be mindful that it degrades the UX with flickering and loss of client-side-only states, such as scroll position.

5000 ms (5 seconds)

pnpm.enable

Enable pnpm instead of npm to resolve and download front-end dependencies. It’s set to false since npm is used by default. Set it to true to enable pnpm. See Switching Between npm and pnpm for more information.

false

productionMode

Set the application to work in production mode. It disables most of the logged information that appears on the server and browser console to improve performance. Development mode JavaScript functions aren’t exported. Any push is given as a minified JavaScript file instead of a full-size one and any static resources are cached. See the Deploying to Production for more information. Set to true when building applications for public deployment.

false

pushLongPollingSuspendTimeout

Set the timeout in milliseconds for network requests when using long polling transport. If you have long polling enabled with a proxy that has a timeout, you want pushLongPollingSuspendTimeout to be shorter than the proxy timeout to make clients reconnect.

-1 (no timeout)

pushMode

Enable server push. The permitted values are "disabled", "manual", or "automatic". See Server Push for more information.

disabled

pushServletMapping

Specify the servlet mapping used for bidirectional ("push") client-server communication. Some Java application servers require special context, for example for websockets, which you can specify here.

""

requestTiming

Include basic timing information in responses that can be used for performance testing.

true for development mode and false for production mode.

syncIdCheck

Enable sync ID checking. The sync ID is used to handle situations where the client sends a message to a connector that has been removed from the server. It’s set to true by default, and you should only disable it if your application doesn’t need to stay in sync and suffers from a bad network connection.

true

webComponentDisconnect

Set the number of seconds that a Vaadin application embedded as a Web Component waits for a reconnect before removing the server-side component from memory.

300 seconds (5 minutes)

27BF72FB-1E23-42B0-B540-A602F9AD4571