springboot报错Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFac

Posted 学习笔记

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了springboot报错Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFac相关的知识,希望对你有一定的参考价值。

springboot项目在启动时需要把servlet容器编译进去,这时候如果你的maven依赖里面没有配置jetty或者tomcat相关依赖就会报错。

解决方法:

jetty添加

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-jetty</artifactId>
    <scope>provided</scope>
</dependency>

tomcat添加:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-tomcat</artifactId>
    <scope>provided</scope>
</dependency>

 

以上是关于springboot报错Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFac的主要内容,如果未能解决你的问题,请参考以下文章