dea启动spring boot项目报错:

org.springframework.context.ApplicationContextException: Unable to
start embedded container; nested exception is
org.springframework.context.ApplicationContextException: Unable to
start EmbeddedWebApplicationContext due to missing
EmbeddedServletContainerFactory bean.
Caused by: org.springframework.context.ApplicationContextException:
Unable to start EmbeddedWebApplicationContext due to missing
EmbeddedServletContainerFactory bean.

依赖包:

org.springframework.boot
spring-boot-starter-tomcat
${springboot-version}
provided

打包是不需要tomcat的,所以这里把tomcat的依赖改为provided,但是idea存在一个bug,就是provided的pom不会加入classpath中,所以运行的时候就找不到tomcat相关的包,
解决:

clipboard.png

选择debug run 或run启动项目


秃头盘
120 声望46 粉丝

静己思过