Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion articles/flow/integrations/spring/routing.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ In `WAR` applications, all `@Route` annotations are discovered automatically, du
The https://vaadin.com/directory/component/vaadin-spring/overview[Vaadin Spring add-on] implements scanning for router classes in Spring Boot applications. This is also true for other Vaadin types that need to be discovered and registered at start-up. However, scanning only occurs inside the Spring Boot application class package, that is, the package in which the `@SpringBootApplication` class is in. If your application contains route classes in packages that aren't scanned by default, you have two options:

- Move them to the package (or sub-package) in which the `@SpringBootApplication` application class is in, or
- Explicitly specify the packages that should be scanned. You can specify packages to scan using the `value` parameter in the `@EnableVaadin` annotation.
- Explicitly specify the packages that should be scanned. You can specify packages to scan using the `value` parameter in the `@EnableVaadin` annotation. [since:com.vaadin:vaadin@V25.4]#You can add this annotation to more than one configuration class#, for example one per module, and Vaadin scans the packages of all of them.

Explicitly specified packages replace the default location. Once any `@EnableVaadin` annotation specifies packages, the package of the `@SpringBootApplication` class is no longer scanned, so if it contains route classes, add it to the packages as well. An `@EnableVaadin` annotation without a `value` adds no packages and doesn't restore the default location.

[NOTE]
The `@EnableVaadin` annotation is required when using <<spring-mvc#,Spring MVC>> without <<spring-boot#,Spring Boot>>. When using Spring Boot, auto-configuration automatically enables Vaadin with a default location to scan for Vaadin routes. You can still use the `@EnableVaadin` annotation in a Spring Boot application specifically for the purpose of replacing the default configuration.
Expand Down
Loading