From ad837f49dc661045b3748c151e0f4cc460700f8d Mon Sep 17 00:00:00 2001 From: Vaadin Bot Date: Fri, 23 Oct 2026 14:21:07 +0200 Subject: [PATCH] docs: note that @EnableVaadin merges packages across classes Explain that applying @EnableVaadin to several configuration classes scans the packages of all of them, on the routing page's guidance for specifying Vaadin scan packages. Documents vaadin/flow#26482 (`efb883dc60ec5cb5853c9733800c72b408e5e2e8`). --- articles/flow/integrations/spring/routing.adoc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/articles/flow/integrations/spring/routing.adoc b/articles/flow/integrations/spring/routing.adoc index ca999d8b1a..f402adc12e 100644 --- a/articles/flow/integrations/spring/routing.adoc +++ b/articles/flow/integrations/spring/routing.adoc @@ -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 <> without <>. 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.