You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2022/12/14 10:30:13 UTC

[GitHub] [dubbo] robberphex commented on issue #10374: dubbo 使用 k8s 为注册中心, 消费者@DubboReference providedby 不配置 提示没有服务提供者

robberphex commented on issue #10374:
URL: https://github.com/apache/dubbo/issues/10374#issuecomment-1350825641

   现在的搞法是:
   ```java
   public interface GreetingService {
       String sayHello(String name);
   }
   
   @Component("annotatedConsumer")
   public class GreetingServiceConsumer {
       @DubboReference(version = "1.0.0", providedBy = "dubbo-samples-xds-provider")
       private GreetingService greetingService;
   }
   ```
   "在消费者端指定providedBy没有在服务提供者端指定好,毕竟服务提供者是最知道自己的应用名的,所以可以在暴露出来的interface上带上这个应用名信息",我觉得这样是比较ok的。
   代码上可以改成这样:
   ```java
   @DubboProvidedbBy("dubbo-samples-xds-provider")
   public interface GreetingService {
       String sayHello(String name);
   }
   
   @Component("annotatedConsumer")
   public class GreetingServiceConsumer {
       @DubboReference(version = "1.0.0")
       private GreetingService greetingService;
   }
   ```


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org