Documentation

Documentation versions (currently viewingVaadin 23)

You are viewing documentation for Vaadin 23. View latest documentation

Configuration Properties

Vaadin applications have configuration properties that change their behavior.

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

For Spring-based applications, there are Spring-specific instructions available.

Using System Properties

When using Java’s system properties to set the Vaadin application parameters, the vaadin. prefix needs to be specified before the parameter names. The following is an example of how to set a system property when executing a Maven goal from the command-line:

mvn jetty:run -Dvaadin.frontend.url.es6=https://mydomain.com/es6/ -Dvaadin.frontend.url.es5=https://mydomain.com/es5/

System properties can be configured for Maven plugin executions. For instance, the following sets a Vaadin-specific system property when the Jetty Maven plugin is run:

<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 own servlet. Otherwise, it’s done automatically by Vaadin with default parameter values.

@WebServlet(urlPatterns = "/*", name = "myservlet", asyncSupported = true, loadOnStartup = 1,
    initParams = {
        @WebInitParam(name = "frontend.url.es6", value = "https://mydomain.com/es6/"),
        @WebInitParam(name = "frontend.url.es5", value = "https://mydomain.com/es5/") })
public class MyServlet extends VaadinServlet {
}

Yet another approach is to use the web.xml file like so:

<?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>frontend.url.es6</param-name>
      <param-value>https://mydomain.com/es6/</param-value>
    </init-param>

    <init-param>
      <param-name>frontend.url.es5</param-name>
      <param-value>https://mydomain.com/es5/</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
When a system property and a servlet parameter have the same name, the system property is used.

Configuration Properties

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

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

Property name

Description

Default value

brotli

Checks whether pre-compressed Brotli files should be used if available.

true

closeIdleSessions

When set to true, the Vaadin session is closed if no UI is active. A UI is active if it is open on the client-side and has some activity in addition to heartbeat requests. By default, heartbeat requests cause the Vaadin session to stay open even if there is no user interaction. If closeIdleSessions is true, the Vaadin session closes without user interaction.

false

devmode.liveReload.enabled

If you are using a server-side live reload tool, the browser is automatically refreshed after the code is reloaded on the server.

true

devmode.optimizeBundle

By default in development mode, all front-end resources found in the classpath are included in the generated bundle. When set to true, this creates an optimized bundle by including only front-end resources that are used from the application entry points. It uses bytecode scanning, which increases application start-up time.

false for development mode, true for production mode

devmode.sessionSerialization.enabled

When session serialization is disabled, UI instances and registered StreamResource instances are not serialized or deserialized when restarting the development server. Enabling the property allows, for example, access control information to be preserved during development, so that you don’t need to log in again for each individual change.

false

devmode.usageStatistics.enabled

Enables Vaadin to collect usage statistics that are used to guide development further. Statistics are collected based on features used in the application. No data is collected in production mode. Some versions of Vaadin also collect usage statistics through the web browser. See the documentation for the client-side collector for information on how to opt out of that part of the usage statistics collection. Only used in development mode.

true

disable.automatic.servlet.registration

Configuration name for the parameter that determines whether Vaadin should automatically register servlets that are required for the application to work.

false

disable-xsrf-protection

Cross-site request forgery protection. The protection is enabled by default, but you may want to disable it for a certain type of testing. The check can be disabled by setting the init parameter.

false

eagerServerLoad

If the client-side bootstrap page should include the initial UIDL fragment.

false

heartbeatInterval

UIs that are open on the client-side send a regular heartbeat to the server indicating that they are still alive, even when there is no 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 is expressed in seconds.

300 seconds (this equals 5 minutes)

i18n.provider

I18N provider property. To use localization and translation strings, the application only needs to implement I18NProvider and define the fully qualified class name in the property i18n.provider. See the Localization documentation for more details.

null

maxMessageSuspendTimeout

In certain cases, for example, when the server sends adjacent XmlHttpRequest responses and pushes messages over a low-bandwidth connection, the messages may be received out of sequence by the client. This property specifies the maximum time in milliseconds that the client waits for predecessors of a received out-of-sequence message before considering them missing. It then requests a full resynchronization of the application state from the server. You may increase this if your application experiences an undue quantity of resynchronization requests. However, that degrades the UX due to flickering and loss of client-side-only states, such as scroll position.

5000 ms

pnpm.enable

This flag can be used to enable pnpm instead of npm to resolve and download front-end dependencies. By default, this flag is set to false, and npm is used. Setting it to true enables pnpm. See how to switch between npm and pnpm.

false

productionMode

Sets the application to work in production mode. Production mode disables most of the logged information that appears on the console. Otherwise, logging and other debugging features can have a significant impact on performance. Development-mode JavaScript functions aren’t exported. A push is given as a minified JavaScript file instead of a full-size one, and static resources are cached. See Deploying to Production for more information.

false

pushLongPollingSuspendTimeout

Specifies how long it accepts responses after each network request in milliseconds when using the long polling transport strategy.

-1 (no timeout)

pushMode

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

disabled

pushServletMapping

Sets the servlet mapping used for bidirectional ("push") client-server communication.

""

requestTiming

If set to true, the server includes some basic timing information in each response. This can be used for performance testing.

true for development mode, false for production mode

sendUrlsAsParameters

Enables or disables sending URLs as GET and POST parameters in requests with content-type application/x-www-form-urlencoded.

true

syncIdCheck

Enables or disables 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.

true

useDeprecatedV14Bootstrapping

This flag can be used to enable the server-side bootstrapping mode used in Vaadin 14 and earlier versions. This option is only supported if webpack is used as the front-end build tool instead of Vite, which is used by default. You can enable webpack using its associated feature flag.

false (mode removed in v24)

webComponentDisconnect

Defines the number of seconds that a WebComponent waits for a reconnect before removing the server-side component from memory.

300 seconds

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