springboot异常
异常如下:
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代码!!!
最新文章
- 设计模式之行为类模式大PK
- 强制 history 不记住特定的命令
- Windows建立Cucumber和Ruby测试环境
- Sql Server 聚集索引扫描 Scan Direction的两种方式------FORWARD 和 BACKWARD
- 在线OJ实用技巧(转载)
- 获取局域网ip
- c++复习基础要点02 虚函数与模板 与static inline是否共存
- 蓝桥杯之K好数问题
- 客户端程序通过TCP通信传送";小文件";到服务器
- ASP.NET From表单转实体类
- 查看Eclipse版本号及各个版本区别
- Java7 和 Java8 中的 ConcurrentHashMap 原理解析
- Luogu4492 [HAOI2018]苹果树 【动态规划】
- 2013年省赛H题
- Python基于皮尔逊系数实现股票预测
- int、bool和str
- JavaI/O(输入/输出)
- flex常用兼容写法
- Python exp() 函数
- c#使用emit方法DB,实体相互转换
热门文章
- SqlServer:SqlServer(存储过程动态表查询(取消返回值),事务处理,批量还原sqlserver备份,强制删除被占用的数据库)
- Django路由系统-URLconf配置、正则表达式简述
- python基础 --- 难点重点
- 【JulyEdu-Python基础】第 3 课:容器以及容器的访问使用
- 再谈mysql锁机制及原理—锁的诠释
- thinkphp5.1 关于加载静态资源路径问题
- mysql行(记录)的详细的操作
- Python模拟进度条
- Peter and Snow Blower CodeForces - 613A (点到线段距离)
- [转载]static in Java