• 前提条件

安装好了 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. js | javascript获取和设置元素的属性

    获取和设置元素的内容: var nv = document.getElementById("pid"); alert(nv.innerHTML); nv.innerHTML=&qu ...

  2. Tornado异步之-协程与回调

    回调处理异步请求 回调 callback 处理异步官方例子 # 导入所需库 from tornado.httpclient import AsyncHTTPClient def asynchronou ...

  3. MAC系统如何显示隐藏文件解决方法

    苹果Mac OS 操作系统下,隐藏文件默认为隐藏状态,隐藏文件是否显示有多种方法可以设置. 方法一: 打开终端,输入命令行 1.显示Mac隐藏文件的命令: defaults write com.app ...

  4. MySQL实现排名并查询指定用户排名功能,并列排名功能

    MySQL实现排名并查询指定用户排名功能,并列排名功能 表结构: CREATE TABLE test.testsort ( id int(11) NOT NULL AUTO_INCREMENT, ui ...

  5. php成绩排序

    $arr = ['12','12','23']; $arr = $arr; $arr1=$arr; rsort($arr1); $c=[]; foreach ( $arr as $k=>$v){ ...

  6. 在Pycharm中导入第三方模块库(诸如:matplotlib、numpy等)

    在Pycharm中导入第三方模块库 一.打开pycharm: 二.点击菜单上的“file” -> “setting”: 三.步骤二完成后出现界面如下所示.选中你的项目(比如thisyan Pro ...

  7. List集合中的对象比较,取出不同对象

    今天在做金碟系统与我们系统的对接的时候需要做一个客户同步 在同步时,需要比较对象,对查询出的数据库的数据进行比较 for(int i=0;i<list2.size();i++){ if(! li ...

  8. Java:static的作用分析

    static表示“静态”或者“全局”的意思,但在Java中不能在所有类之外定义全局变量,只能通过在一个类中定义公用.静态的变量来实现一个全局变量. 一.静态变量 1. Java中存在两种变量,一种是s ...

  9. Hibernate-ORM:14.Hibernate中的命名查询

    ------------吾亦无他,唯手熟尔,谦卑若愚,好学若饥------------- 本篇博客讲述命名查询,所谓命名查询是什么呢? Hibernate中允许我们在xml,实体类,甚至注解的方式来编 ...

  10. .NET基础知识之七——索引器

           索引器是什么?有什么作用?索引器允许类的实例以访问数组的形式来访问对象里面的属性.如我们经常可以看到类似于dr["name"]="test",或者 ...