将maven项目改造成springboot项目

  1. pom.xml配置之springboot
    1.1 继承springboot父项目依赖
1
2
3
4
5
6
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.0</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>

1.2 插件依赖

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
 <dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>

</dependencies>
  1. 启动类配置
1
2
3
4
5
6
@SpringBootApplication
public class SquareApplication {
public static void main(String[] args) {
SpringApplication.run(SquareApplication.class,args);
}
}
  1. application.yml