The @SpringBootApplication annotation

The @SpringBootApplication annotation is a shortcut for three annotations:

  • @Configuration: Indicates that this a Spring application context configuration file.
  • @EnableAutoConfiguration: Enables auto-configuration, an important feature of Spring Boot. We will discuss auto-configuration later in a separate section.
  • @ComponentScan: Enables scanning for Spring beans in the package of this class and all its subpackages.

Get Mastering Spring 5.0 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.