
SpringBoot Application Annotations
Let's see how to make this a Spring Boot application. The following is the very minimum you have to do to make this, or in fact any Java application, a Spring Boot application.
Create a Main Class:
Create a main class extending from the Spring Boot servlet initializer class.
Place the main class in the root package to enable component scan for the entire project.
Example root package structure: com.commit.
Add Spring Boot Application Annotation:
Add the @SpringBootApplication annotation to the main class.
This annotation is equivalent to declaring @EnableAutoConfiguration, @ComponentScan, and @Configuration.
Add Main Method:
Add the main method to the main class.
In the main method, delegate to the static run method of the Spring application class, providing the main class and args as parameters.
In the main method, use SpringApplication.run() to launch the application.
コメント