问题一:自定义的service找不到

问题描述

代码里写的是:

@Resource
CustomerService customerService;

错误信息:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'customerDetailController': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named 'customerService' is expected to be of type 'com.xxxx.xxxx.gateway.biz.service.customer.CustomerService' but was actually of type 'com.alibaba.dubbo.common.bytecode.proxy17'

原因

dubbo里注册了同名的服务CustomerService,与自定义的'com.xxxx.xxxx.gateway.biz.service.customer.CustomerService'类名冲突。

问题二:找不到dubbo服务

问题描述

错误信息:

Description:
A component required a bean of type 'com.xxxx.xxx.api.customer.service.customer.CustomerDetailService' that could not be found.

Action:
Consider defining a bean of type 'com.xxxx.xxx.api.customer.service.customer.CustomerDetailService' in your configuration.

原因

工程里里有个注册dubbo服务的xml文件,需要注册dubbo服务

<dubbo:reference id="CustomerDetailService" interface="com.xxxx.xxx.api.customer.service.customer.CustomerDetailService"
                     protocol="dubbo" check="false" timeout="${dubbo.service.timeout}"
                     retries="${dubbo.service.retries}" registry="haunt"/>

标签: none

添加新评论