@SpringBootApplication
The annotation on a Spring Boot main class that switches on component scanning, auto-configuration and configuration declarations in one go.
In more detail
The main method calls SpringApplication.run, which creates the application context and starts the application. The annotation implements no endpoint or business rule; it marks where framework infrastructure becomes available.
Example
@SpringBootApplication public class Application { ... SpringApplication.run(Application.class, args); }Related terms
- component scanning — Spring searching the application's packages at startup for classes marked with annotations such as @Service and registering them as beans.
- auto-configuration — Spring Boot's mechanism for creating infrastructure beans automatically when their libraries are on the class path and no bean of your own replaces them.
- application context — The running Spring container: the object that holds every bean for an application and manages their creation and shutdown.
- main method — The method the JVM calls first when it starts a program: public static void main(String[] args).
Taught in
- Spring Boot Auto Configuration — Modern Java: Virtual Threads & High-Throughput Services