Annotation Interface EnableVaadin


Brings in the machinery to setup Spring + Vaadin applications. This annotation should be added on a Configuration class of the application to automatically import Vaadin configuration (such as VaadinScopesConfig).

Use this annotation in your Spring Boot application to scan the packages with Vaadin types that should be discovered at startup (e.g. routes via @Route annotation).

You don't need this annotation if your application runs as a Web application being deployed into a Web container. But if you run your application as a Spring Boot application then classpath scanning is disabled due the Spring Boot design (see ServletContainerInitializers issue). Spring Vaadin add-on implements this scanning for you but it uses the default application package for this (the package where you have your Spring Boot application class). It means that if your Vaadin classes are inside this package or its descendant subpackage then everything works out of the box. Otherwise you should use EnableVaadin annotation with package names to scan at startup as a value.

Author:
Vaadin Ltd
See Also:
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Base packages to scan for annotated classes on Vaadin startup.
  • Element Details

    • value

      String[] value
      Base packages to scan for annotated classes on Vaadin startup.

      If packages are not specified then default Spring Boot application package is used.

      Returns:
      the base packages to scan
      Default:
      {}