I had the same problem, and to solve it, I renamed my packages as follows.
"com.project"
there you can place the main SpringBootAplication class, and then just create the rest of the packages starting with "com.project"
"com.project.dao"
"com.project.controller"
By creating this subproject structure, you do not need to use scanBasePackages in the @SpringBootApplication annotation, by doing this, your main class will be able to find every component in your project.
And if you decide to use scanBasePackages, remember that you need to install all your component packages like this.
@SpringBootApplication (scanBasePackages = {"com.project.dao", "Com.project.controller"})
Wesley silva
source share