SpringBoot启动时的异常信息如下:

 1 "C:\Program Files\Java\jdk1.8.0_161\bin\java" ......... com.fangxing.javalearning.annotationlearning.ComponentScanApp
2 hello world
3
4 . ____ _ __ _ _
5 /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
6 ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
7 \\/ ___)| |_)| | | | | || (_| | ) ) ) )
8 ' |____| .__|_| |_|_| |_\__, | / / / /
9 =========|_|==============|___/=/_/_/_/
10 :: Spring Boot :: (v2.0.0.RELEASE)
11
12 2018-04-03 22:25:07.232 INFO 4976 --- [ main] c.f.j.a.ComponentScanApp : Starting ComponentScanApp on DESKTOP-BHGM3HS with PID 4976 (started by hasee in D:\test\projects\java-learning)
13 2018-04-03 22:25:07.237 INFO 4976 --- [ main] c.f.j.a.ComponentScanApp : No active profile set, falling back to default profiles: default
14 2018-04-03 22:25:07.321 INFO 4976 --- [ main] ConfigServletWebServerApplicationContext : Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@45f45fa1: startup date [Tue Apr 03 22:25:07 CST 2018]; root of context hierarchy
15 2018-04-03 22:25:07.664 WARN 4976 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: 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.
16 2018-04-03 22:25:08.238 ERROR 4976 --- [ main] o.s.boot.SpringApplication : Application run failed
17
18 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.
19 at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:155) ~[spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]
20 at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543) ~[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE]
21 at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140) ~[spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]
22 at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:752) [spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]
23 at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:388) [spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]
24 at org.springframework.boot.SpringApplication.run(SpringApplication.java:327) [spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]
25 at org.springframework.boot.SpringApplication.run(SpringApplication.java:1246) [spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]
26 at org.springframework.boot.SpringApplication.run(SpringApplication.java:1234) [spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]
27 at com.fangxing.javalearning.annotationlearning.ComponentScanApp.main(ComponentScanApp.java:15) [classes/:na]
28 Caused by: org.springframework.context.ApplicationContextException: Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean.
29 at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.getWebServerFactory(ServletWebServerApplicationContext.java:204) ~[spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]
30 at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:178) ~[spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]
31 at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:152) ~[spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]
32 ... 8 common frames omitted
33
34
35 Process finished with exit code 1

Spring Boot启动出现错误,错误内容大概的意思是:未能加载嵌入的供web应用加载的空间,是因为缺少ServletWebServerFactory bean,在stackflow上面看到了这个错误的解决办法,原文如下:

The scheduling guide isn't a web app so you probably have some mouldy stuff in your pom.xml from the REST guide? If you follow the instructions closely it should work. Another potential issue with the code you posted above is that your  @EnableAutoConfigurationclass is not used in the context, only as a main method (which may not be a problem for the scheduling guide but it probably is for a bunch of others).

这里,添加了一个@EnableAutoConfiguration注解来解决问题。

参考文档:

https://blog.csdn.net/u010429286/article/details/52636753

http://stackoverflow.com/questions/21783391/spring-boot-unable-to-start-embeddedwebapplicationcontext-due-to-missing-embedd

最新文章

  1. Atitit 图像处理 深刻理解梯度原理计算.v1 qc8
  2. CAS单点登录和spring securtiy集成
  3. 猿题库 iOS 客户端架构设计
  4. 浅谈T-SQL中的子查询
  5. 针对跑MySQL的Linux优化【转】
  6. 001课-java_web开发入门
  7. JS中的for/in语句和arguments参数
  8. ORA-02041: client database did not begin a transaction
  9. String 方法
  10. SQL SERVER 2008 架构
  11. Android自学绝佳资料
  12. CDOJ 1272 Final Pan's prime numbers
  13. Python爬虫之urllib模块2
  14. java.util.ConcurrentModificationException 记一次坑
  15. div界面元素生成图片
  16. Python3基础 list + *运算 扩充列表
  17. 当mysql 遇到 ctrl+c
  18. adc转换原理
  19. hdu 5310(贪心)
  20. Hadoop整理五(基于Hadoop的数据仓库Hive)

热门文章

  1. qt mvc2
  2. OpenJudge数据结构与算法-计算点的距离并排序
  3. linux内核中#if IS_ENABLED(CONFIG_XXX)与#ifdef CONFIG_XXX的区别
  4. LC 918. Maximum Sum Circular Subarray
  5. js求数组最大值方法
  6. Android仿微信底部选项卡
  7. 常用学习&面试资源网站
  8. Linux 验证当前 Video0 不否是v4l设备 linux v4l 编程(1) Video 4 Linux 简介
  9. VisualStudio版本号
  10. kafka和zookeeper的配置文件优化配置