0 day streak
java / beginner
Snippet

Main Application Class

Every Spring Boot project needs a main class with the @SpringBootApplication annotation to bootstrap the application context and start the embedded server.

snippet.java
java
1
2
3
4
5
6
7
@SpringBootApplication
public class MyShopApplication {
public static void main(String[] args) {
SpringApplication.run(MyShopApplication.class, args);
}
}
spring
Breakdown
1
@SpringBootApplication
Enables auto-configuration, component scanning, and extra configuration features.
2
SpringApplication.run(...)
The static method used to launch the entire Spring application.