如果你使用的是SpringBoot自帶的tomcat出現這種問題 那么換成別的容器就行了。
首先要將已經存在的容器排除掉 使用 exclusions 排除容器依賴 然后再添加別的容器依賴
比如
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-undertow</artifactId>
</dependency>
如果你使用的恰好是undertow這個容器 那么換成tomcat容器試試
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-tomcat</artifactId> </dependency>
我自己整合的時候沒有出現過這種問題,但是使用開源框架的時候出現了這種問題,
經過排查發現作者使用的是undertow容器。
參考文章: