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启动后,其它包无法找到, 就会导致以上错误。

  • 相关阅读:
    企业级开发的权限管理
    asp.net mvc 中的ajax
    拖拽(非原创)
    数据库中主键和外键的设计原则
    第六篇续:动态创建 ListView 模板
    动态创建 ASP.NET Web 服务器控件模板(出自MSDN)
    ASP.NET跨页面传值的几种方法
    奇文共赏 史记货殖列传王石传
    需求该如何分析?
    PopupControlExtender 控件的使用(转)
  • 原文地址:https://www.cnblogs.com/chry/p/8066111.html
Copyright © 2011-2022 走看看