(1)创建一个MavenProject
(2)修改pom文件,添加以下内容
<parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.5.18.RELEASE</version> </parent>
<!--web应用基本环境配置 --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency>
<build> <plugins> <!-- spring-boot-maven-plugin插件就是打包spring boot应用的 --> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build>
(3)添加配置文件application.properties
1)在src/main路径下创建resource文件夹
2)创建application.properties
3)将resource文件夹添加到source folder
(4)添加启动类
package com.songyan.share; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; /** * @author songyan * @date 2020年3月19日 上午9:49:19 * @desc 启动类 */ @SpringBootApplication public class Application { public static void main( String[] args ) { SpringApplication.run(Application.class, args); } }