When you use @SpringBootApplication annotation in for example package
com.company.config
it will automatically make component scan like this:
@ComponentScan("com.company.config")
So it will NOT scan packages like com.company.controller etc.. Thats why you have to declare your @SpringBootApplication in package one level prior to your normal packages like this: com.company OR use scanBasePackages property, like this:
@SpringBootApplication(scanBasePackages = { "com.company" })
OR componentScan:
@SpringBootApplication
@ComponentScan("com.company")