Vaadin Starter for Spring Boot - Component Scan Issue

This is not an issue with Vaadin, it’s just something to be aware of with the Spring Boot starter.

From this page https://vaadin.com/start/latest/project-base, generate new Spring Boot based Flow project and open in an IDE (Intellij in my case).

The Application class (annotated wth @SpringBootApplication) is in a package called spring. If you define spring component classes in packages that are not at the same level or below the spring package, then when the project is run, Spring does not scan the components and they are not initialized (and are null when injected into classes that need to use them).

The solution is to move the Application class to the same level (or above) the packages where your Spring components are defined. Or alternatively use the Spring component scan configuration to specify the packages that contain your Spring components.