b2科目四模拟试题多少题驾考考爆了怎么补救
b2科目四模拟试题多少题 驾考考爆了怎么补救

dubbo框架_dubbo zookeeper_阿里弃用dubbo后新框架(4)

电脑杂谈  发布时间:2017-04-03 12:08:36  来源:网络整理

其次是dubbo配置,配置在Spring配置文件中,我这里起名叫spring-dubbo.xml

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

<!-- 提供方应用信息,用于计算依赖关系 -->
<dubbo:application name="dubbo-practice-provider" />

<!-- 使用Zookeeper集群注册中心暴露服务地址 -->
<dubbo:registry protocol="zookeeper" address="192.168.157.130:2181,192.168.157.129:2181" />

<!-- 用dubbo协议在20880端口暴露服务,一个项目需要一个端口 -->
<dubbo:protocol name="dubbo" port="20880" />

<!-- Service 提供者 -->
<!-- 声明需要暴露的服务接口,intece指定接口,ref指定真正的实现者 -->
<dubbo:service intece="com.ddup.dubbo.service.api.PersonService" ref="personService" />

</beans>

最后,做好之后就可以运行了,我写了一个简单的启动服务类/dubbo-practice-provider-impl/src/main/java/com/ddup/dubbo/service/impl/Main.java,运行这个就行了,不要关。

服务消费者项目

源码地址:dubbo-practice-consumer;

主要就是Dubbo服务的调用了,见spring-dubbo.xml:

<!-- 消费方应用名,用于计算依赖关系,不是匹配条件,不要与提供方一样 -->
<dubbo:application name="dubbo-practice-consumer" />

<!-- 使用Zookeeper集群注册中心暴露服务地址 -->
<dubbo:registry protocol="zookeeper" address="192.168.157.130:2181,192.168.157.129:2181" />

<!-- 生成远程服务代理,可以和本地bean一样使用demoService -->
<dubbo:reference id="personService" intece="com.ddup.dubbo.service.api.PersonService" />


本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/shumachanpin/article-39219-4.html

相关阅读
    发表评论  请自觉遵守互联网相关的政策法规,严禁发布、暴力、反动的言论

    • 焦紫杰
      焦紫杰

      给自己一个追求新生的机会

    • 郭林君
      郭林君

      啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊

    热点图片
    拼命载入中...