一、工程的maven项目转成Spring Boot项目
1. pom.xml
引入 Spring Boot
的父级依赖
引入 Spring Boot
的父级依赖,这样当前的项目就是 Spring Boot
项目了。spring-boot-starter-parent
是一个特殊的 starter
,它用来提供相关的 Maven
默认依赖。使用它之后,常用的包依赖可以省去 version
标签。
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.2.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
2. 搭建web应用,根据模块实现(必须项,否则无法作为web项目访问
)
当有些模块我们需要搭建web应用的时候,可以像下面这样添加spring-boot-starter-web依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>2.2.2.RELEASE