Spring官网https://spring.io
- 项目中引入依赖
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.2</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
- 添加启动类Application
一个项目只能有一个启动类
@SpringBootApplication //标记成Springboot的启动类
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class,args);
}
}
直接运行Application类