Documentation versions (currently viewingVaadin 24)

Vaadin Spring Configuration

Configuring Spring properties in a Vaadin application.

You can use many properties to configure a Vaadin application. For example, com.vaadin.server.DeploymentConfiguration and com.vaadin.server.Constants classes are available for the numerous property names. Additionally, you can set Spring properties as system properties. Spring configuration properties use the same names, but are prefixed with vaadin.. See the complete list of configuration properties.

Special Configuration Parameters

Spring has several special configuration parameters, such as ones for scanning packages, preventing the handling of specific URLs, and more. They’re described in the sections that follow.

Configure Packages Scanning

To decrease startup time during development, as well as the build time for the production bundle, Vaadin Flow excludes many packages from being scanned for annotations — such as ones belonging to the java and springframework packages. The set of packages that Flow excludes by default is defined in the VaadinServletContextInitializer class.

You can extend this list of packages to exclude from scanning by using the vaadin.blocked-packages property, which contains a comma-separated string. To do that, you would do something like the following:


The allowed-packages is also a comma-separated string, but it contains a list of the only packages that need to be scanned for UI components and views. You should set this property to improve performance during development, especially in large applications. The com/vaadin/flow/component package is implicitly included and is always scanned.


Use either allowed-packages or blocked-packages — not both. If both are used and have values, though, blocked-packages is ignored.

The previous vaadin.whitelisted-packages and vaadin.blacklisted-packages properties have been deprecated, and will be removed in the future.

JAR Packages Scanning

To optimize package scanning within a JAR file, add a META-INF/VAADIN/ file inside the JAR to define JAR specific scanning rules. In a Maven artifact with jar packaging, create a src/main/resources/META-INF/VAADIN directory and add a file with the desired configuration.

The file effects only the target JAR content. It supports vaadin.allowed-packages and vaadin.blocked-packages properties in the same way as in the file. The vaadin.blocked-jar=true property is used to disable scanning of the JAR, entirely.

Prevent Handling of Specific URLs

For some use cases, it’s desirable to exclude specific URLs from being handled by Vaadin, without changing the Vaadin URL mapping. For example, to integrate Swagger-UI, Vaadin shouldn’t handle requests for resources accessed by /swagger-ui.html.

The list of URL patterns that should not be handled by the Vaadin servlet, can be configured using the vaadin.exclude-urls property in the form of a comma-separated string.


This configuration only applies when the Vaadin servlet is mapped to the root mapping.

Launch Browser in Development Mode

You can configure a Spring Boot project to launch the default browser when starting the application in development mode by setting the following property:

vaadin.launch-browser = true

After a server restart, the application refrains from opening a new browser tab until a thirty-minute interval has elapsed to avoid excessive tab proliferation. This delay is reset upon each server restart. In the event of a restart occurring before the interval lapses, a new tab will be opened thirty minutes post-restart.

The delay duration can be changed by configuring the vaadin.launch-browser-delay property to specify the number of minutes before initiating a new tab launch.

To trigger the tab opening immediately, you can perform a project cleanup (e.g., mvn clean or gradle clean). Or you can delete the tab.launch file in the build directory (e.g., target for Maven, build for Gradle).

The example below shows how to set the duration, with the value in minutes:

vaadin.launch-browser-delay = 30

Initial Data Cache in Development Mode

During development of a project, Vaadin caches automatically some initialization data. For instance, cached data includes details about resources to load, as well as dynamically generated white-lists of packages that need to be scanned for annotations. This caching is done to shorten the turnaround time of automatic restart on class modification.

Automatic caching won’t occur if your application is running in production mode. Plus, it requires that Spring Boot Development Tools be enabled.

Some project resources and classes always need to be scanned, though, and cannot rely on caching. Also, caching can produce unexpected errors after reloads. For these reasons, you may want to disable caching. This can be done using the following property:

vaadin.devmode-caching = false

Spring Boot Properties

You can set properties for Spring Boot in your file. An example of this would be setting Spring URL mapping in


By default, URL mapping is /*.

An additional servlet (e.g., /my_mapping/*) is required to handle the frontend resources for non-root servlets. The servlet can be defined in your application class. See Application class for an example.

Configure Spring MVC Applications

If you use Spring MVC, and hence the VaadinMVCWebAppInitializer sub-class, you need to populate your configuration properties.

Setting configuration properties, for example, in a Spring MVC application would look like this:

public class MyConfiguration {


The file here is still used, but you can use any name and any property source.

Configure Spring Boot Development Tools

Sometimes when using Spring Boot Development Tools with automatic restart enabled, more than one restart can be triggered. It depends on how many files are changed at once, and how the IDE is changing monitored files. As a result, this may slow the overall restart time.

Spring Development tools has two properties in the file that can be adjusted to improve the restart time: spring.devtools.restart.poll-interval; and spring.devtools.restart.quiet-period.

Poll interval is the frequency in which classpath directories are polled for changes. The default is 1 second. The quiet period ensures that there are no additional changes. It’s default is 400 milliseconds.

In a small project developed with Eclipse, for example, using the following smaller values can increase the restart time when changing one or a few classes:


As another example, in a project developed with IntelliJ IDEA, increasing values can ensure that restart happens only once after changing one or a few classes:


For larger applications, try to increase the values for these properties to avoid multiple restarts. A second more for the poll interval doesn’t matter much if everything else takes more than ten seconds to restart.

There isn’t one value that’s best for all development environments. The examples here are presented to show how to make adjustments — not as recommended values.