zoukankan      html  css  js  c++  java
  • Spring boot多模块(moudle)中的一个注入错误(Unable to start embedded container; nested exception is org)

    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)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:536)
        at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:737)
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:370)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:314)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1162)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1151)
        at com.moerlong.platform.service.demo.calculator.application.CalculatorApplication.main(CalculatorApplication.java:25)
    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)
        at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:162)
        at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:134)
        ... 8 common frames omitted

    主模块中需要的bean在另外一个模块中定义, 但运行时, 无法注入。原因是:

    SpringBoot约定的bean搜索路径是从@SrpingBootApplication所在在包开始的, 也就是说,所有其它包都必须在这个包之下, 否则SpringBoot启动后,其它包无法找到, 就会导致以上错误。

  • 相关阅读:
    域名解析 A记录 MX记录 CNAME记录 TTL
    在SQL Server Management Studio中还原数据库
    Intel 2200BG无线网卡在2003下的使用
    Javascript 如何得到input type="radio" 的值?
    建立自动备份的维护计划
    [zt]再谈QQ自动登陆器:提供C#源码下载(下)
    Ajax 和 XML: 借鉴最优秀的 Ajax 应用程序
    征服 Ajax 应用程序的安全威胁
    为FckEditor增加插件,添加自定义的功能按钮ToolBarButton
    开发端到端的 Ajax 应用程序,第 1 部分: 用一个场景设置 Ajax 环境
  • 原文地址:https://www.cnblogs.com/chry/p/8066111.html
Copyright © 2011-2022 走看看