Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean.

今天开始学习Spring Boot,在开始做第一个Hello world的时候就出现了错误,首先创建一个Maven工程,


写好了第一个demo后,尝试使用main方法启动Spring Boot的方式启动,然而却并不能启动成功,报了如下的错误:


*************************************************************************************************


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.


大致的错误的意思是:未能加载嵌入的供web应用加载的空间,是因为缺少ServletWebServerFactory bean

然后在网上找到了解决的方法,就是在main方法的类上面加上一个@EnableAutoConfiguration注解来解决


然后运行main方法就能正常启动Spring Boot应用了。

猜你喜欢

转载自blog.csdn.net/kaifaxiaoliu/article/details/79881879