日常记录,记下来自己的遇到的问题

2018-08-08

一个 spring boot 集合 dubbo 项目,在运行的时候报了这样子的一个错:

java.lang.IllegalArgumentException: @Service interfaceClass() or interfaceName() or interface class must be present!

我查找了很长时间,也没找到答案,最后只能自己查代码喽,发现这行代码的返回值为 null

Class<?>[] allInterfaces = annotatedServiceBeanClass.getInterfaces();

最后是因为代码中 @Service 修饰的类没直接继承接口,而是他的父类继承了接口,接着 dubbo 报错了,是因为 dubbo 进行接口注入的时候,必须直接实现接口

下面是具体的代码结构

//  接口
public interface IRedisService
//  实现接口的父类
public class BaseRedisServiceImpl implements IRedisService

 //  子类之前没后面的implement

 @Service(version="1.0", group="redis_jcaptcha")
 public class CaptchaRedisServiceImpl extends BaseRedisServiceImpl implements IRedisService

猜你喜欢

转载自www.cnblogs.com/season1992/p/9443933.html