-
Notifications
You must be signed in to change notification settings - Fork 26.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@Reference注解不支持泛型注入? #664
Comments
确认一下@reference是否已经加入Spring的自动扫描路径中? https://dubbo.gitbooks.io/dubbo-user-book/content/configuration/annotation.html |
加入了,把父类去掉,写成以下方式是可以正常使用的,写成泛型注入的方式就不行 |
确认了一下,不是泛型的问题,是属性声明在父类BaseController导致无法注入。 |
退订
在2017年09月19日 11:48,li362692680 写道:
加入了,把父类去掉,写成以下方式是可以正常使用的,写成泛型注入的方式就不行
@RestController
@RequestMapping("/questionary")
public class QuestionaryController{
@reference(QuestionaryServiceI.class)
private QuestionaryServiceI service;
@RequestMapping(value="/delete",produces="application/json;charset=UTF-
8",method=RequestMethod.POST)
public Result delete(@requestbody QuestionaryEntity entity){
return ResultUtil.converter(service.delete(entity));
}
}
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
请问下 这个问题解决了吗?我也发送此问题 api:
} provider:
} consumer: public class BaseController
} @EnableAutoConfiguration
} maven 版本:
consumer报错信息: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dubboConsumerBootstrap': Injection of @reference dependencies is failed; nested exception is java.lang.IllegalArgumentException: @service interfaceClass() or interfaceName() or interface class must be present! Disconnected from the target VM, address: '127.0.0.1:58069', transport: 'socket' Process finished with exit code 1 |
//父类
public class BaseController<S extends DubboServiceI,T>{
@reference
private S service;
}
//子类
@RestController
@RequestMapping("/questionary")
public class QuestionaryController extends BaseController<QuestionaryServiceI,QuestionaryEntity>{
}
这种写法消费端不能注入到zk中,也不能调用,启动也不报错,@reference是否支持这种写法??
The text was updated successfully, but these errors were encountered: