Vaadin Flow/Spring doesn’t add class with @Route annotation to the internal list of routes targets, if the class out of the package where MyApplication is located.
@SpringBootApplication
open class MyApplication {
…
Daniel Hons:
ComponentScan will Scan the package beginning from where the annotation is placed. So this is intended.
Sure, I know this.
I applied @ComponentScan with parameter set to value of root/parent package in other my (non-vaadin) spring based applications. Class with @Route annotation is within the package, included into root/parent package, that is leveraged as parameter of @ComponentScan. Unfortunately, @ComponentScan doesn’t pickup @Route annotations. @ComponentScan processes other spring annotations like @Component, but not @Route.
// By default, classes with @Route annotation are searched in the package (and its sub-packages), where @SpringBootApplication class is located.
// Spring, Spring Boot and Component Scan http://www.springboottutorial.com/spring-boot-and-component-scan
// PRB: @ComponentScan doesn't search classes, annotated with @Route. It searches only classes with Spring annotations.
@ComponentScan("vlfsoft")
// Solution:
@EnableVaadin("vlfsoft")
@SpringBootApplication
open class PetClinicApplication {