环境:
springboot2.x
使用springboot依赖配置如图:
该dependencies内置tomcat版本为9.0.13
解决办法:
找到本地路径:
C:\Users\Administrator.m2\repository\org\springframework\boot\spring-boot-dependencies
打开spring-boot-dependencies-2.1.1.RELEASE.pom文件
找到<tomcat.version>9.0.13</tomcat.version>部分
修改为<tomcat.version>8.5.20</tomcat.version>即可,如图:
另外注意移除springboot对内置tomcat的依赖,如下:
<!-- 去除springboot 内置tomcat服务器 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<!-- 移除嵌入式tomcat插件 -->
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- 加入tomcat支持 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>