Docs

Documentation versions (currently viewingVaadin 14)

You are viewing documentation for an older Vaadin version. View latest documentation

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

blacklisted-packages is a comma separated string that can be used to blacklist packages from getting scanned in v14 (npm mode) projects. As the default set of packages doesn’t cover everything that we shouldn’t be interested in.

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 the performance during development, it’s recommended to set 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. In case both of them have values, blacklisted-packages will be ignored.

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 frontend resources for non-root servlets. The servlet can be defined in your application class. See this Application class for a example.

Configuring Spring MVC Applications

If you use Spring MVC, and therefore 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.

BDD8E74B-D824-45C7-83F8-F57CFD2FC24B