【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