三种方式创建Spring Boot工程
在线创建
在线创建指的就是利用Spring Boot官方提供的创建流程创建项目后导入工程
访问网址:https://start.spring.io/
创建项目后会生成一个压缩包
解压后的目录结构
在IDE中open即可使用
IDE创建
IDE创建以IDEA为例
选择Create New Project 或File–>new -->Project
接着Next
接着勾选需要用到的依赖
通过普通maven工程改造
通过IDEA创建一个普通的maven工程,在pom.xml中添加parent标签和依赖
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.6.RELEASE</version>
</parent>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
添加一个启动类
@RestController
@EnableAutoConfiguration
public class App {
public static void main(String[] args) {
SpringApplication.run(App.class, args);
}
}