springboot项目出现Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFact

springboot项目运行出现Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean.错误,可能由以下情况引起
1、缺少web启动器依赖

<dependency>
   <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
</dependency>

2、启动类传递的class对象名称不正确

@SpringBootApplication
public class Application {
    public static void main(String[] args) {
        // 此处传递的class对象与当前类名称不一致
        SpringApplication.run(Appendable.class, args);
    }
}
©️2020 CSDN 皮肤主题: 撸撸猫 设计师:设计师小姐姐 返回首页