关于IDEA springboot项目运行时Unable to start web server问题解决

报错内容:

org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.context.ApplicationContextException: Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean

解决方法:

首先,先确保正确创建springboot项目,创建项目是选择spring Initializr,而不是maven项目

项目创建确保后,在你所运行时需要用的的每个类上方添加@EnableAutoConfiguration

记住,是每个类,而不是main方法这一个类,再次尝试运行,就可以了!(提示:有的解决方法告诉说删除依赖的包,那个是完全不可行的,因为版本是建项目时就选好的,和那个没关系)

猜你喜欢

转载自blog.csdn.net/panruola/article/details/87889481