开发者社区 > 云原生 > 正文

@DubboReference(version="*")功能是否与官网描述一致?

https://cn.dubbo.apache.org/zh-cn/overview/mannual/java-sdk/advanced-features-and-usage/service/multi-versions/ 根据官网的描述: 老版本服务提供者配置 <dubbo:service interface="com.foo.BarService" version="1.0.0" />

新版本服务提供者配置 <dubbo:service interface="com.foo.BarService" version="2.0.0" />

消费者如果不需要区分版本,可以按照以下的方式配置 <dubbo:reference id="barService" interface="com.foo.BarService" version="" /> 测试代码: 消费者 @DubboReference(group="dubbo", version="", check = false) private HelloService helloService;

2个服务提供者 @DubboService(group="dubbo", version="v1.0.0") public class HelloServiceImpl implements HelloService { ... }

@DubboService(group="dubbo", version="v2.0.0") public class HelloServiceImplV2 implements HelloService { ... }

控制台日志: org.apache.dubbo.rpc.RpcException: Failed to invoke the method sayHello in the service com.shiguang.platform.provider.common.HelloService. No provider available for the service dubbo/com.shiguang.platform.provider.common.HelloService:* from registry 127.0.0.1:8848 on the consumer 192.168.0.107 using the dubbo version 3.0.8. Please check if the providers have been started and registered.

dubbo 3.0.8 + Nacos 2.1.0 + SpringBoot 2.6.4 无论是@DubboReference注解方式还是泛化调用都试了,都是No provider错误,请问不区分版本调用功能是否已支持,还是我的demo使用问题?

原提问者GitHub用户guipengfei

展开
收起
大圣东游 2023-05-11 15:45:09 127 0
1 条回答
写回答
取消 提交回答
  • 我在我这边dubbo3.0.8+nacos2.1.2+springboot2.6.4是没有问题的,你应该检查一下你的服务是否已经注册上注册中心了,建议在你的配置上面加一下dubbo.scan.base-package。

    在AbstractRegistry#noifty中调用了UrlUtils#isMatch,在如下进行处理

    回答3.png

    原回答者GitHub用户MieAh

    2023-05-12 10:16:38
    赞同 展开评论 打赏

阿里云拥有国内全面的云原生产品技术以及大规模的云原生应用实践,通过全面容器化、核心技术互联网化、应用 Serverless 化三大范式,助力制造业企业高效上云,实现系统稳定、应用敏捷智能。拥抱云原生,让创新无处不在。

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载