0
点赞
收藏
分享

微信扫一扫

Dubbo粗浅记录


这篇博客只是我自己的学习记录,对各位高手怕是没有什么太大的帮助,望高手不吝赐教。


项目的截图如下:

Dubbo粗浅记录_笔记

我们使用的主要就是红框里面的。




这里我主要分析两个xml




/DubboTest/src/main/resources/spring/dubbo-provider.xml


<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://code.alibabatech.com/schema/dubbo
http://code.alibabatech.com/schema/dubbo/dubbo.xsd
">
<dubbo:application name="hello-world-app" />

<!-- zookeeper注册中心 -->
<dubbo:registry protocol="zookeeper" address="10.150.0.80:2181" />
<!-- 使用multicast广播注册中心暴露服务地址 -->
<!-- <dubbo:registry address="multicast://10.57.41.19:1234" /> -->
<dubbo:protocol name="dubbo" port="20880" />

<!-- 和本地bean一样实现服务 -->
<dubbo:service interface="com.ruishenh.dubbo.example.DemoService" ref="demoService3" />

<bean id="demoService3" class="com.ruishenh.dubbo.example.DemoServiceImpl" />
</beans>





/DubboTest/src/main/resources/spring/dubbo-consumer.xml


<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://code.alibabatech.com/schema/dubbo
http://code.alibabatech.com/schema/dubbo/dubbo.xsd
">
<!-- 消费方应用名,用于计算依赖关系,不是匹配条件,不要与提供方一样 -->
<dubbo:application name="consumer-of-helloworld-app" />
<!-- zookeeper注册中心 -->
<dubbo:registry protocol="zookeeper" address="10.150.0.80:2181" />
<!-- 使用multicast广播注册中心暴露的服务地址 -->
<!--<dubbo:registry address="multicast://10.57.41.19:1234" /> -->
<!-- 生成远程服务代理,可以和本地bean一样使用demoService -->
<dubbo:reference id="demoService3" interface="com.ruishenh.dubbo.example.DemoService" />
</beans>

我就记录一点

在consumer.xml里面

<dubbo:reference id="demoService3" interface="com.ruishenh.dubbo.example.DemoService" />


这个id指的是


<bean id="demoService3" class="com.ruishenh.dubbo.example.DemoServiceImpl" />


这里面这个id。


服务引用BeanId

Dubbo粗浅记录_Dubbo_02




我自己以前总觉得<dubbo:service里面应该有个一个id,<dubbo:reference里面应该有个一个属性叫做fromid,指向dubbo:service那个id






另外


dubbo还有一个admin管理界面,请自行百度之。


项目代码:

​​http://pan.baidu.com/s/1hqVbbQs​​





举报

相关推荐

0 条评论