Spring boot3.x 内置的tomcat和pom.xml中引入的tomcat冲突。1.将自己引入的删除。然后就直接可以跑起来了。2.或者将tomcat内置的排除,再加上重新从tomcat官网下载的tomcat环境和依赖包,scope为provided。排除内置的tomcat:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
如果idea中配置了重新下载的tomcat10,(idea专业版才能找到tomcat server),idea 社区版没有。
重新sync maven后,clean install后,外置的tomcat就可以跑起来了。