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

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM