• 前提条件

安装好了 ZooKeeper 作为注册中心

  • 服务端
<?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:context="http://www.springframework.org/schema/context"
xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.2.xsd
http://code.alibabatech.com/schema/dubbo
http://code.alibabatech.com/schema/dubbo/dubbo.xsd"> <!--这个包下的,所有加过特殊注解的类,都被Spring管理-->
<context:component-scan base-package="org.zln" resource-pattern="**/*ServiceImpl.class"/> <!--开启注解注入-->
<context:annotation-config/> <dubbo:application name="providerDemo" />
<!--ZooKeeper 注册中心-->
<dubbo:registry protocol="zookeeper" address="127.0.0.1:2181" />
<!--Dubbo 协议暴露服务的端口-->
<dubbo:protocol name="dubbo" port="20880" />
<!--需要暴露的服务接口-->
<dubbo:service interface="org.zln.service.SayHelloService" ref="sayHelloService"/> </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:context="http://www.springframework.org/schema/context"
xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.2.xsd
http://code.alibabatech.com/schema/dubbo
http://code.alibabatech.com/schema/dubbo/dubbo.xsd"> <!--dubbo 消费方名称-->
<dubbo:application name="consumerDemo" /> <!--ZooKeeper 注册中心-->
<dubbo:registry address="zookeeper://127.0.0.1:2181" />
<!--生成远程服务代理-->
<dubbo:reference id="sayHelloService" interface="org.zln.service.SayHelloService"/>
</beans>

Dubbo 的 Helloworld的更多相关文章

  1. Dubbo 版 Helloworld

    使用工具:MAVEN.IDEA.Spring.Dubbo.Zookeeper 直接上代码 项目结构: 步骤如下: 搭建MAVEN项目,添加相关依赖 pom.xml <!--Zookeeper-- ...

  2. Dubbo(五) Dubbo入门demo——helloworld

    前言 前面我已经介绍了dubbo的一些基本工具和知识,让大家简单的了解了下RPC框架和Dubbo.接下来就是重点了,Dubbo的helloworld项目. 一.搭建项目 首先我们新建三个maven项目 ...

  3. Dubbo与SpringBoot整合流程(从实例入手,附代码下载)

    场景 Dubbo环境搭建-管理控制台dubbo-admin实现服务监控: https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/10362 ...

  4. Dubbo--002--例子程序

    虽然项目中用到了dubbo,还是想自己玩玩写个demo.百度一搜,关于dubbo的helloworld基本都是在windows上做的.现在在Linux上玩一下. 环境准备: jdk版本:1.7 服务器 ...

  5. Dubbox 环境搭建

    第一章:Dubbox简介 Dubbox是一个开源的RPC(Remote ProcedureCall Protocol)远程调用框架,是由dangdang对阿里的Dubbo的升级,可以被视为Dubbo的 ...

  6. JMicro微服务Hello World

    概述 JMicro是本人开发的基于Java实现的微服务框架,前两天发布0.0.3正式版本,并已发布到maven中央仓库. 项目源码github:https://github.com/mynewworl ...

  7. Dubbo源码-从HelloWorld开始

    Dubbo简介 Dubbo,相信做后端的同学应该都用过,或者有所耳闻.没错,我就是那个有所耳闻中的一员. 公司在好几年前实现了一套自己的RPC框架,所以也就没有机会使用市面上琳琅满目的RPC框架产品. ...

  8. dubbo入门之helloWorld

    dubbo官方文档:http://dubbo.apache.org/zh-cn/docs/user/quick-start.html 基于spring coloud的demo:http://start ...

  9. Dubbo学习笔记(一) 基础知识HelloWorld

    Dubbo是由阿里巴巴研发出的一款基于Java实现的RPC框架,现由Apache进行维护管理,笔记中使用zookeeper作为注册中心,dubbo+zookeeper环境安装教程:https://ww ...

随机推荐

  1. 实现php Curl 调用不同项目中方法

    之前为了实现跨项目调用方法,遇到的一些问题和解决方法总结. 话不多说,直接复制代码先跑了再说! jq代码. $.ajax({ type: "post", dataType: &qu ...

  2. 【路由和交换之H3C自导自演】

    H3C配置自导自演 显示和维护及恢复 1:display display history-command    :查看历史命令记录 display diagnostic-information :查看 ...

  3. STM32CubeMx配置USART注意的一个问题

    HAL_UART_Receive_IT(&huart1, (uint8_t *)aRxBuffer, Number);意思是接收到Number个字节后,触发HAL_UART_RxCpltCal ...

  4. python3 练习题100例 (二十九)猴子吃桃问题

    题目内容: 猴子第一天摘下若干个桃子,当即吃了一半,还不过瘾,又多吃了一个第二天早上又将剩下的桃子吃掉一半,又多吃了一个.以后每天早上都吃了前一天剩下的一半零一个.到第n天(<1<n< ...

  5. DedeCMS V5.7sp2最新版本parse_str函数SQL注入漏洞

    织梦dedecms,在整个互联网中许多企业网站,个人网站,优化网站都在使用dede作为整个网站的开发架构,dedecms采用php+mysql数据库的架构来承载整个网站的运行与用户的访问,首页以及栏目 ...

  6. 解决MySQL server has gone away问题的两种有效办法

    最近做网站有一个站要用到WEB网页采集器功能,当一个PHP脚本在请求URL的时候,可能这个被请求的网页非常慢慢,超过了mysql的 wait-timeout时间,然后当网页内容被抓回来后,准备插入到M ...

  7. 关于在各种int类型选择时的考虑

    整数类型int在不同版本的c标准中不断丰富. 最初的K&R标准给出了int作为整数的基本类型,给出long.short.unsigned作为int的变式.在c90中又加入了signed. 在c ...

  8. class实现Stack

    基于class实现一个存储string类型的Stack 头文件: //stack.h #include<vector> #include<string> class Stack ...

  9. Ubuntu无法安装vim怎么办?(Ubuntu 出现apt-get: Package has no installation candidate问题)

    apt-get install vim 正在读取软件包列表... 完成 正在分析软件包的依赖关系树 正在读取状态信息... 完成 有一些软件包无法被安装.如果您用的是不稳定(unstable)发行版, ...

  10. WPF把CheckBox的文字放到左边,开关在右边

    原文:WPF把CheckBox的文字放到左边,开关在右边 效果 实现 这篇文章给了一个不错的参考方案. http://www.codeproject.com/Articles/19141/WPF-Ch ...