Easy java spring

6. Difference between @ComponentScan and @SpringBootApplication?

Sample answer: "@ComponentScan only scans for components. @SpringBootApplication is a shortcut for three annotations: @EnableAutoConfiguration, @ComponentScan on the package of the main class, and @SpringBootConfiguration. That's why the main class should sit in the root package."

Sources (1)
  1. Using the @SpringBootApplication annotation