spring boot 启动报错 Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean
踩坑记录,之前spring boot项目,打成 war 包,现在改回来打成 jar 包,修改后启动出现 Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean 错误,百度后解决,记录如下
导入 spring-boot-starter-web
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
核对 pom文件发现,我项目导入的是
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
修改依赖后成功解决问题
参考链接:Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean
本文记录了从WAR包切换到JAR包时遇到的SpringBoot启动错误:Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean。通过检查并更正pom文件中的依赖,从spring-boot-starter调整为spring-boot-starter-web,成功解决了问题。
1万+

被折叠的 条评论
为什么被折叠?



