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