Documentation versions (currently viewingVaadin 24)

Vaadin Spring Configuration

How to configure Spring properties in a Vaadin application.

You can use many properties to configure your Vaadin application. For example, there are the com.vaadin.server.DeploymentConfiguration and com.vaadin.server.Constants classes for the numerous property names. In addition to these, you can also 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

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

Configure the Scanning of Packages

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

You can extend this list using the vaadin.blocked-packages property, which is a comma-separated string that can be used to exclude packages from being scanned. You would do something like the following:


The allowed-packages is a comma-separated string that can be used to specify 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.

You should use either allowed-packages or blocked-packages — not both. If both 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.

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 Automatically in Development Mode

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

vaadin.launch-browser = true

Initialization Data Caching 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 requires that your application is not running in production mode, and that you have Spring Boot Development Tools 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 situations, you may want to disable caching. This can be done using the following property:

vaadin.devmode-caching = false

Using 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, such as /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.

Configuring 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.

Configuring 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 all may slow the overall restart time.

Spring Development tools has two properties in the file that can be adjusted to help and thereby 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.

For example, in a small project developed with Eclipse, 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 given as suggestion of how to make adjustments — not as recommended values.