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

相关文章
相关标签/搜索