← All tutorials

GoCareerGo Tutorials

Spring Boot Tutorial

Auto-configuration, REST APIs, JPA, AOP, caching, microservices and Spring Cloud.

The @SpringBootApplication Main Class

A single annotation that combines three others to bootstrap the entire application.

// @SpringBootApplication is shorthand for:
@Configuration
@EnableAutoConfiguration
@ComponentScan
public class DemoApplication {
    public static void main(String[] args) {
        SpringApplication.run(DemoApplication.class, args);
    }
}
  • @Configuration — this class can declare @Bean methods
  • @EnableAutoConfiguration — turns on classpath-based auto-configuration
  • @ComponentScan — scans this package and sub-packages for @Component beans