【dubbo】dubbo项目 通过RPC方式调用自己应用对外提供的dubbo接口

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 id="bbbService" interface="com.xxx.api.AAAService" check="false"/>

Java使用:

@Resource
private AAAService bbbService;

bbbService.method1();
原文地址:https://www.cnblogs.com/sxdcgaq8080/p/13626538.html