当前位置: 代码迷 >> 综合 >> missing ServletWebServerFactory bean
  详细解决方案

missing ServletWebServerFactory bean

热度:4   发布时间:2024-02-09 14:23:32.0

 

点击了报错行,在报错行打了个断点,发现是没取到这个bean。

启动了另一个web项目,同样一个地方打了断点,发现取到的是tomcatServletWebServerFactory。

判断到没有引入tomcat即web类的依赖。

不过看pom是引入了。发现boot-web依赖下面有个排除。去掉之后报错依旧。

进行重新clean pom,重新编译启动

Caused by: org.springframework.context.ApplicationContextException: Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean.at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.getWebServerFactory(ServletWebServerApplicationContext.java:206) ~[spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE]at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:180) ~[spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE]at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:154) ~[spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE]... 8 more

 

  相关解决方案