Configuration Properties
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 setting a system property when executing a Maven goal from the command line:
mvn jetty:run -Dvaadin.frontend.url.es6=http://mydomain.com/es6/ -Dvaadin.frontend.url.es5=http://mydomain.com/es5/
System properties can be configured for Maven plugin executions. For instance, the following example 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 alternative 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 is done automatically by Vaadin with default parameter values):
@WebServlet(urlPatterns = "/*", name = "myservlet", asyncSupported = true, initParams = {
@WebInitParam(name = "frontend.url.es6", value = "http://mydomain.com/es6/"),
@WebInitParam(name = "frontend.url.es5", value = "http://mydomain.com/es5/") })
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>
<init-param>
<param-name>frontend.url.es6</param-name>
<param-value>http://mydomain.com/es6/</param-value>
</init-param>
<init-param>
<param-name>frontend.url.es5</param-name>
<param-value>http://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
If you have a system property and a servlet parameter with the same name, the system property will be 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 prefix vaadin. ; for example, vaadin.productionMode=true .
|
closeIdleSessions
The default is
false
. When set totrue
, the session is closed if no UI is active. From the servlet container’s viewpoint, heartbeat requests are like any other request. This means that, as long as there is an open UI, the session never expires, even if there is no user interaction. You can control this behavior by setting an init parameter namedcloseIdleSessions
totrue
.devmode.liveReload.enabled
The default is
true
. This means that if you are using some live reload tool on the server side, the browser is refreshed automatically after the code is reloaded on the server side.devmode.sessionSerialization.enabled
The default is
false
. Determines whether theVaadinSession
instances of the users are serialized on server shutdown when running in development mode. When the parameter is set tofalse
, only other HTTP session data is serialized/deserialized on development server restart. Enabling the property allows, for example, access control information to be retained during development, so that you do not need to log in again for each change.devmode.optimizeBundle
The default is
true
in production mode. By default, in development mode all front-end resources found on the class path are included in the generated webpack bundle. When set totrue
, this creates an optimized bundle by including only front-end resources that are used from the application entry points. Uses bytecode scanning, which increases application startup time.disable.automatic.servlet.registration
Configuration name for the parameter that determines whether Vaadin should automatically register servlets needed for the application to work.
disable-xsrf-protection
Cross-site request forgery protection. This protection is enabled by default, but it might need to be disabled to allow a certain type of testing. For these cases, the check can be disabled by setting the init parameter.
frontend.url.es5
A location that Vaadin searches for web component files in production mode when the request comes from older browsers not supporting ES6, the default version of the web component development language.
frontend.url.es6
A location that Vaadin searches for web component files in production mode when the request comes from modern browsers.
heartbeatInterval
Affects Flow applications only. UIs that are open on the client side send a regular heartbeat to the server to indicate they are still alive, even though there is no ongoing user interaction. When the server does not receive a valid heartbeat for a given UI, it will eventually remove that UI from the session.
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 propertyi18n.provider
. See the Localization documentation.load.es5.adapters
Include polyfills for browsers that do not support ES6 to their initial page. For web components to work, extra libraries (polyfills) are required to be loaded. This can be turned off if different versions or libraries should be included instead.
maxMessageSuspendTimeout
In certain cases, such as when the server sends adjacent
XmlHttpRequest
responses and push messages over a low-bandwidth connection, messages may be received out of sequence by the client. This property specifies the maximum time (in milliseconds) that the client will wait for the predecessors of a received out-of-sequence message before considering them missing. It will then request a full resynchronization of the application state from the server. The default value is 5,000 ms. You may increase this if your application experiences an undue quantity of resynchronization requests. These degrade the UX due to flickering and loss of client-side-only state, such as scroll position.original.frontend.resources
Configuration name for the parameter that determines whether Vaadin should use bundled fragments.
pnpm.enable
This flag can be used to enable
pnpm
instead ofnpm
to resolve and download front-end dependencies. By default, it isfalse
andnpm
is used. Setting it totrue
enablespnpm
. See how to switch between npm and pnpm.productionMode
Sets the application to work in production mode. Production mode disables most of the logged information that appears on the console, because logging and other debug features can have a significant impact on performance. Development-mode JavaScript functions are not exported,
push
is given as a minified JavaScript file, instead of full size, and static resources are cached. See Deploying to Production for more information.pushLongPollingSuspendTimeout
Affects Flow applications only. When using the long polling transport strategy, this specifies for how long it accepts responses after each network request, in milliseconds.
pushMode
Affects Flow applications only. The permitted values are "disabled" or "manual". See Server Push for more information.
pushURL
Affects Flow applications only. The URL to use for push requests. Some servers require a predefined URL to push. See Server Push for more information.
requestTiming
If this is set to
true
, the server includes some basic timing information in each response. This can be used for performance testing.sendUrlsAsParameters
Returns
true
if the sending of URLs as GET and POST parameters in requests with content-typeapplication/x-www-form-urlencoded
is enabled.syncIdCheck
The default is
true
. Returns whether sync ID checking is enabled. The sync ID is used to gracefully handle situations when the client sends a message to a connector that has recently been removed on the server.useDeprecatedV14Bootstrapping
This flag can be used to enable the server-side bootstrapping mode which was used in Vaadin 14 and earlier versions.
27BF72FB-1E23-42B0-B540-A602F9AD4571