Documentation

Documentation versions (currently viewingVaadin 23)

Vaadin Spring Configuration

You can use many properties to configure your Vaadin application. See, for example, the com.vaadin.server.DeploymentConfiguration and com.vaadin.server.Constants classes for the numerous property names. In addition to these properties, you can also set Spring properties as system properties. Spring configuration properties have the same names, but are prefixed with vaadin..

Special Configuration Parameters

Configure the Scanning of Packages

To decrease the startup time during development as well as the build time for the production bundle, Flow automatically excludes a number of packages (such as the ones belonging to the java and springframework packages) from being scanned for annotations. The set of packages that Vaadin Flow excludes by default are defined in the VaadinServletContextInitializer class. You can extend this list using the vaadin.blacklisted-packages property, which is a comma-separated string that can be used to exclude packages from being scanned.

vaadin.blacklisted-packages=org/bouncycastle,com/my/db/package

whitelisted-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. In order to improve performance during development, we recommended setting this property, especially in big applications. Note that com/vaadin/flow/component is implicitly included and is always scanned.

vaadin.whitelisted-packages=com/foo/myapp/ui,com/foo/components
Note
You should use either whitelisted-packages or blacklisted-packages. If both of them have values, blacklisted-packages is ignored.

Launch the Browser Automatically in Development Mode

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

vaadin.launch-browser = true

Using Spring Boot Properties

You can set properties for Spring Boot in your application.properties file.

Example: Setting Spring URL mapping in application.properties.

vaadin.urlMapping=/my_mapping/*
  • By default, URL mapping is /*.

Note
An additional servlet, such as /my_mapping/*, is required to handle the front-end resources for non-root servlets. The servlet can be defined in your application class. See Application class for a example.

Configuring Spring MVC Applications

If you use Spring MVC, and hence the VaadinMVCWebAppInitializer subclass, you need to populate your configuration properties yourself.

Example: Setting configuration properties in a Spring MVC application.

@Configuration
@ComponentScan
@PropertySource("classpath:application.properties")
public class MyConfiguration {

}
  • The application.properties file is still used, but you can use any name and any property source.

58B86F91-8716-4071-AC09-EE19C9A49277