Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean解决方案N种

Spring Boot启动应用总是报错如下:

Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean

与“Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean”如出一辙。

不是技术论坛中大家常说的应用入口类缺少@SpringBootApplication标注,或者是Spring bean缺少@EnableAutoConfiguration标注等问题。

是因为默认使用的嵌入式Tomcat容器无法启动。

解决的办法来了

  1. 删除Maven本地库中有错的tomcat-embed-core,再次构建下载新的tomcat-embed-core,构建错误消失,成功构建完成。
  2. 把嵌入的tomcat注释一下就可以了
  3. 我就是因为排除了嵌入式tomcat,指定本地的tomcat即可。
发布了470 篇原创文章 · 获赞 1541 · 访问量 70万+

猜你喜欢

转载自blog.csdn.net/qq_33589510/article/details/105778942
今日推荐