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();