dubbo项目,从Spring容器中拿一个自己服务提供的dubbo接口直接调用:
[不通过注册中心,效果即自己调用自己的一个Bean]

 

xml配置:

<dubbo:service interface="com.xxx.api.AAAService" ref="aaaService" timeout="5000"/>

<bean name="aaaService" class="com.xxx.api.AAAServiceImpl" />

Java使用:

@Resource
private AAAService aaaService;


aaaService.method1();

 

 

====================================================================================================

dubbo项目,从注册中心通过RPC方式调用自己服务提供的dubbo接口
[通过注册中心,效果即 自己调用别人的dubbo服务一样]

[区别就在于 下面的 蓝色加粗的一行配置]

xml配置:

<dubbo:service  interface="com.xxx.api.AAAService" ref="aaaService"  timeout="5000"/>

<bean name="aaaService" class="com.xxx.api.AAAServiceImpl" />

<dubbo:reference />

 

Java使用:

@Resource
private AAAService bbbService;

bbbService.method1();

 

相关文章:

  • 2022-02-16
  • 2022-12-23
  • 2021-04-02
  • 2022-12-23
  • 2022-12-23
  • 2021-07-07
  • 2021-09-02
  • 2022-02-11
猜你喜欢
  • 2021-04-01
  • 2022-12-23
  • 2022-01-10
  • 2021-10-10
  • 2021-06-07
  • 2022-02-27
相关资源
相似解决方案