添加红框部门,移除tomcat插件
<!-- 移除嵌入式tomcat插件 --> <exclusions> <exclusion> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-tomcat</artifactId> </exclusion> </exclusions> 添加servlet-api的依赖
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
或者
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-servlet-api</artifactId>
<version>8.0.36</version>
<scope>provided</scope>
</dependency>随便选一个
启动类继承
SpringBootServletInitializer 剩下就正常打包war包,扔进tomcat就行了tomcat配置文件的host里面加一句<Context path="/" docBase="register" debug="0" privileged="true" reloadable="true"/>
docBase里面是war包名 以上
原文地址:https://www.cnblogs.com/IceBlueBrother/p/12329526.html
时间: 2024-11-02 22:27:02