【Java】Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean

 前提:maven项目,自己写的spring boot 启动类。

启动报异常信息如下:Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean

解决方案:

百度一下,参考文案:【Java】Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean_No8g攻城狮的博客-CSDN博客

一、启动类忘记添加注解

在main方法所在的类忘记添加@SpringBootApplication;

检查自己的启动类,果然是忘记添加注解。添加注解之后,启动成功。

你可能感兴趣的:(springboot,异常解决方案,spring,boot,java,maven)