为了账号安全,请及时绑定邮箱和手机立即绑定

Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean

 protected EmbeddedServletContainerFactory getEmbeddedServletContainerFactory() {
  String[] beanNames = getBeanFactory().getBeanNamesForType(EmbeddedServletContainerFactory.class);
  System.out.println(getBeanFactory().getClass().getName());
  System.out.println(beanNames.length);
  if (beanNames.length == 0) {
   return null;
  }
  if (beanNames.length == 0) {
   throw new ApplicationContextException("Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.");
  }

  if (beanNames.length > 1) {
   throw new ApplicationContextException("Unable to start EmbeddedWebApplicationContext due to multiple EmbeddedServletContainerFactory beans : " + StringUtils.arrayToCommaDelimitedString(beanNames));
  }

  return (EmbeddedServletContainerFactory) getBeanFactory().getBean(beanNames[0], EmbeddedServletContainerFactory.class);
 }

我调式源码发现

[2017-02-25 20:42:23.864] - 7444 信息 [main] --- com.imooc.GirlApplication: Starting GirlApplication on DESKTOP-JDE5DT4 with PID 7444 (E:\workspace\girl\web\WEB-INF\classes started by javacar in E:\workspace\girl)
[2017-02-25 20:42:23.883] - 7444 信息 [main] --- com.imooc.GirlApplication: No active profile set, falling back to default profiles: default
[2017-02-25 20:42:24.013] - 7444 信息 [main] --- org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext: Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@7fac631b: startup date [Sat Feb 25 20:42:24 CST 2017]; root of context hierarchy
[2017-02-25 20:42:24.813] - 7444 信息 [main] --- org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor: JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
org.springframework.beans.factory.support.DefaultListableBeanFactory
0
[2017-02-25 20:42:25.437] - 7444 信息 [main] --- org.springframework.jmx.export.annotation.AnnotationMBeanExporter: Registering beans for JMX exposure on startup
[2017-02-25 20:42:25.458] - 7444 信息 [main] --- com.imooc.GirlApplication: Started GirlApplication in 2.085 seconds (JVM running for 2.503)

这如何解决,缺什么jar。缺什么配置文件

正在回答

1 回答

放完整代码吧

0 回复 有任何疑惑可以回复我~
#1

car 提问者

这已经是完整源代码了。
2017-03-11 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
2小时学会Spring Boot
  • 参与学习       151581    人
  • 解答问题       1079    个

Spring Boot入门视频教程,你将学会使用Spring Boot快速构建应用程序

进入课程

Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信