异常如下:

org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.context.ApplicationContextException: Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.

at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:137) ~[spring-boot-1.4.4.RELEASE.jar:1.4.4.RELEASE]

at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:536) ~[spring-context-4.3.6.RELEASE.jar:4.3.6.RELEASE]

at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.4.4.RELEASE.jar:1.4.4.RELEASE]

at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:762) [spring-boot-1.4.4.RELEASE.jar:1.4.4.RELEASE]

at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:372) [spring-boot-1.4.4.RELEASE.jar:1.4.4.RELEASE]

at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) [spring-boot-1.4.4.RELEASE.jar:1.4.4.RELEASE]

at org.springframework.boot.SpringApplication.run(SpringApplication.java:1187) [spring-boot-1.4.4.RELEASE.jar:1.4.4.RELEASE]

at org.springframework.boot.SpringApplication.run(SpringApplication.java:1176) [spring-boot-1.4.4.RELEASE.jar:1.4.4.RELEASE]

at com.travelsky.srd.tcldp.SrdTcldpApplication.main(SrdTcldpApplication.java:10) [classes/:na]

Caused by: org.springframework.context.ApplicationContextException: Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.

at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.getEmbeddedServletContainerFactory(EmbeddedWebApplicationContext.java:189) ~[spring-boot-1.4.4.RELEASE.jar:1.4.4.RELEASE]

at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:162) ~[spring-boot-1.4.4.RELEASE.jar:1.4.4.RELEASE]

at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:134) ~[spring-boot-1.4.4.RELEASE.jar:1.4.4.RELEASE]

... 8 common frames omitted

代码如下:

public class hello{

@RequestMapping("/hello")
public String helloWorld(){
return "hello";
}
public static void main(String[] args){
SpringApplication.run(hello.class, args);
}

}

原因是把SpringApplication.run(hello.class, args);写成了SpringApplication.run(Application.class, args); 切记学习的时候不要直接copy代码!!!

最新文章

  1. 设计模式之行为类模式大PK
  2. 强制 history 不记住特定的命令
  3. Windows建立Cucumber和Ruby测试环境
  4. Sql Server 聚集索引扫描 Scan Direction的两种方式------FORWARD 和 BACKWARD
  5. 在线OJ实用技巧(转载)
  6. 获取局域网ip
  7. c++复习基础要点02 虚函数与模板 与static inline是否共存
  8. 蓝桥杯之K好数问题
  9. 客户端程序通过TCP通信传送"小文件"到服务器
  10. ASP.NET From表单转实体类
  11. 查看Eclipse版本号及各个版本区别
  12. Java7 和 Java8 中的 ConcurrentHashMap 原理解析
  13. Luogu4492 [HAOI2018]苹果树 【动态规划】
  14. 2013年省赛H题
  15. Python基于皮尔逊系数实现股票预测
  16. int、bool和str
  17. JavaI/O(输入/输出)
  18. flex常用兼容写法
  19. Python exp() 函数
  20. c#使用emit方法DB,实体相互转换

热门文章

  1. SqlServer:SqlServer(存储过程动态表查询(取消返回值),事务处理,批量还原sqlserver备份,强制删除被占用的数据库)
  2. Django路由系统-URLconf配置、正则表达式简述
  3. python基础 --- 难点重点
  4. 【JulyEdu-Python基础】第 3 课:容器以及容器的访问使用
  5. 再谈mysql锁机制及原理—锁的诠释
  6. thinkphp5.1 关于加载静态资源路径问题
  7. mysql行(记录)的详细的操作
  8. Python模拟进度条
  9. Peter and Snow Blower CodeForces - 613A (点到线段距离)
  10. [转载]static in Java