项目的截图如下:
我们使用的主要就是红框里面的。<?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>
<?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" />服务引用BeanId
dubbo还有一个admin管理界面,请自行百度之。
项目代码:
http://pan.baidu.com/s/1hqVbbQs