<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> <exclusions> <exclusion> <artifactId>tomcat-embed-el</artifactId> <groupId>org.apache.tomcat.embed</groupId> </exclusion> <exclusion> <artifactId>tomcat-embed-websocket</artifactId> <groupId>org.apache.tomcat.embed</groupId> </exclusion> </exclusions> </dependency>
原因是因为spring中存在tomcat jar包冲突,可以查看tomcat的jar包依赖关系,排除不必要的依赖即可解决。一种可能的情况如上图依赖所示。