You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by GitBox <gi...@apache.org> on 2022/03/23 06:40:31 UTC
[GitHub] [servicecomb-java-chassis] sunshinexp1 commented on issue #2740: @RpcReference注解在某些场景会失效
sunshinexp1 commented on issue #2740:
URL: https://github.com/apache/servicecomb-java-chassis/issues/2740#issuecomment-1075978381
我提供一个Demo吧,三个类:
接口类:
`public interface DemoInterface {
void test();
}
`
接口实现类:
`@Service
public class DemoInterfaceImpl implements DemoInterface {
@RpcReference(microserviceName = "DemoService", schemaId = "demo-api")
private IDemoService demoService;
@Override
public void test() {
System.out.println("test");
}
}`
DemoBean类实现FactoryBean,并且通过构造函数注入上述的DemoInterfaceImpl
`@Service
public class DemoBean implements FactoryBean<String> {
@Setter
private DemoInterface demoInterface;
@Autowired
public DemoBean(DemoInterface demoInterface) {
this.demoInterface = demoInterface;
}
@Override
public String getObject() {
return "demoBean";
}
@Override
public Class<?> getObjectType() {
return String.class;
}
@Override
public boolean isSingleton() {
return true;
}
}`
最后出现的问题就是接口实现类DemoInterfaceImpl里的@RpcReference注解不生效
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org