spring boot 报错 Unable to start embedded container;
来源:互联网 发布:p2p类似软件 编辑:程序博客网 时间:2024/05/17 04:44
想做个rest风格的控制器,简单例子:
@RestController@RequestMapping("/user")public class UserController {@RequestMapping("/{id}") public User view(@PathVariable("id") Long id){User user = new User();user.setId(id);user.setName("linli");return user;}public static void main(String[] args) {// TODO Auto-generated method stub SpringApplication.run(UserController.class,args);//System.out.println("sss");}}
启动的时候报错:
. ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v1.3.1.RELEASE)2015-12-22 09:30:23.579 INFO 3208 --- [ main] controller.UserController : Starting UserController on IQSZ-D2678 with PID 3208
2015-12-22 09:30:23.582 INFO 3208 --- [ main] controller.UserController : No active profile set, falling back to default profiles: default2015-12-22 09:30:23.879 INFO 3208 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@12ceb70: startup date [Tue Dec 22 09:30:23 CST 2015]; root of context hierarchy2015-12-22 09:30:24.391 WARN 3208 --- [ main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: 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.2015-12-22 09:30:25.211 ERROR 3208 --- [ main] o.s.boot.SpringApplication : Application startup failedorg.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:133) ~[spring-boot-1.3.1.RELEASE.jar:1.3.1.RELEASE]at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:532) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118) ~[spring-boot-1.3.1.RELEASE.jar:1.3.1.RELEASE]at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:764) [spring-boot-1.3.1.RELEASE.jar:1.3.1.RELEASE]at org.springframework.boot.SpringApplication.doRun(SpringApplication.java:357) [spring-boot-1.3.1.RELEASE.jar:1.3.1.RELEASE]at org.springframework.boot.SpringApplication.run(SpringApplication.java:305) [spring-boot-1.3.1.RELEASE.jar:1.3.1.RELEASE]at org.springframework.boot.SpringApplication.run(SpringApplication.java:1124) [spring-boot-1.3.1.RELEASE.jar:1.3.1.RELEASE]at org.springframework.boot.SpringApplication.run(SpringApplication.java:1113) [spring-boot-1.3.1.RELEASE.jar:1.3.1.RELEASE]at controller.UserController.main(UserController.java:28) [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:185) ~[spring-boot-1.3.1.RELEASE.jar:1.3.1.RELEASE]at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:158) ~[spring-boot-1.3.1.RELEASE.jar:1.3.1.RELEASE]at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:130) ~[spring-boot-1.3.1.RELEASE.jar:1.3.1.RELEASE]... 8 common frames omitted
报的是 无法启动嵌入容器,工厂类不存在。
在类头加上 @EnableAutoConfiguration。就OK了。这个接口看名字是允许自动配置。
2 0
- spring boot 报错 Unable to start embedded container;
- Spring Boot启动报错Unable to start embedded Tomcat
- Spring Boot启动报错Unable to start embedded Tomcat
- Spring Boot常见问题(二)Unable to start embedded container; nested exception is java.lang.NoSuchMethodErro
- SpringBoot启动报错" Unable to start embedded container; nested exception is org.springframework.beans.fa
- SpringBoot 启动报错:Unable to start embedded
- spring boot启动报Unable to start EmbeddedWebApplicationContext问题解决方案
- org.springframework.context.ApplicationContextException: Unable to start embedded container; nested
- 关于spring boot org.springframework.context.ApplicationContextException:Unable to start Embedded解决方案
- Spring Boot 工程启动报错"org.springframework.context.ApplicationContextException: Unable to start ..."解决方案
- Unable to start embedded Tomcat
- springboot 启动异常 javax/servlet/ServletContext Unable to start embedded container; nested exception is
- Spring Boot: Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFa
- Spring-boot Unable to start EmbeddedWebApplicationContext 分析与解决方法
- springcloud Unable to start embedded Tomcat 问题
- spring boot 启动报A child container failed during start java.util.concurrent.ExecutionException: org.ap
- SpringBoot 启动服务器失败 报错 spring-boot Failed to start component [StandardServer[-1]]
- 初次搭建spring boot maven项目报错之Unable to find main class
- iOS自定义控件_CustomTextView
- Android Framework探索
- 排序算法复习(1)-- 快速排序
- 第三方库管理工具 cocoapods的介绍和安装
- JSR 133 in Public Review Blog
- spring boot 报错 Unable to start embedded container;
- Android 自定义圆形进度条
- Image对象生成Base64位编码
- Git的使用教程(二)初识Git
- 运算长方体体积及面积
- Git多人协作
- 23种设计模式(10):命令模式
- 什么叫函数对象(仿函数)
- Git学习笔记与IntelliJ IDEA整合