本次步骤,我的项目名shirostudy
本地项目打成war包
修改打包方式为war
关闭springboot内置tomcat
在pom文件中添加以下的依赖,重点是scope
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
增加启动类
在你的application启动类同级目录下,增加一个用于解析war包下的web.xml的类
package by.start.shirostudy;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
/**
* @author bystart
* @date 2020/7/17 9:26
* 仔细!坚持!
* ❥(^_-))
*/
public class ServletInitializer extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder