dubbo分佈式Service不能夠建立Error creating bean with name 'XXXXXX'

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'demoService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.ylx.mapper.TbBrandMapper com.ylx.service.sellergoods.BranService.tbBrandMapper; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.ylx.mapper.TbBrandMapper] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

這個是錯誤信息:先說下解決的思路java

  • 先檢查的Service實現層dubbo有沒有掃描此包web

    • <dubbo:annotation package="包名" />
  • web.xml中的listener有沒有監聽到dao(mybatis生成的mapper(java文件))service(Service的實現類文件)的配置文件spring

  • 注意一些model生成的打包方式(必定要看清楚)數據庫

    在上面的這些配置我檢查了無數次(包括和別人對照代碼),仍是出現這個錯誤,這個時候有點懷疑是否是這兩個配置文件根本就沒有加載。mybatis

    • dao的配置文件主要是設置數據庫鏈接池的一些信息
    • service是設置向註冊中心註冊的設置(這兩個配置文件都要加載),這兩個文件我是在service實現類的web.xml中監聽ContextLoaderListener初始化的。
  • 由於這個service一直不能夠建立,全部多是這個加載配置文件的web.xml文件沒有加載到這兩個配置文件。app

    由於我一直感受高版本的不靠譜,我就將4.0換成了2.5maven

    而後maven中從新clear install.ui

    運行程序,完美解決,**Service不能建立竟然是web.xml版本問題this

這個只是發生錯誤的一種解決方案,多是其它的問題引發的這個錯誤,此文僅供參考code

相關文章
相關標籤/搜索