1、先创建一个maven项目,选择quickstart
创建项目
2、在pom文件中添加父项目
<!-- 父项目-->
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.6.2</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
3、对需要的jar包进行依赖
<!-- web-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
4、给启动类添加注解SpringBootApplication,并且改写main方法内的内容就可以了。
5、更改完成之后要将maven中自带的test类删除
更多...
5、若需要更改配置则需要在main文件夹下创建资源文件夹,右键更改文件夹类型为resources Root
6、在资源文件夹内创建application.yml文件,在其中配置资源