使用dubbo时报错:注入service出错BeanCreationException: Error creating bean with name。。。

来源:互联网 发布:基于内容推荐算法 编辑:程序博客网 时间:2024/06/07 11:22

使用dubbo时,新加controller和service,注解都写完,但是后台报错无法找到service注入,报错信息为:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'departmentController': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.csair.test.user.service.DepartmentService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@javax.annotation.Resource(shareable=true, mappedName=, description=, name=, type=class java.lang.Object, lookup=, authenticationType=CONTAINER)}

这种一般是配置文件的问题,要记得在provider和consummer的xml文件中声明暴露服务和使用服务

    <!-- provider -->    <bean id="departmentService" class="com.csair.test.user.service.impl.DepartmentServiceImpl"/>
<!--consumer--><dubbo:reference id="departmentService" interface="com.csair.test.user.service.DepartmentService" />
阅读全文
0 0
原创粉丝点击