Dubbo 的 Helloworld
- 前提条件
安装好了 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的更多相关文章
- Dubbo 版 Helloworld
使用工具:MAVEN.IDEA.Spring.Dubbo.Zookeeper 直接上代码 项目结构: 步骤如下: 搭建MAVEN项目,添加相关依赖 pom.xml <!--Zookeeper-- ...
- Dubbo(五) Dubbo入门demo——helloworld
前言 前面我已经介绍了dubbo的一些基本工具和知识,让大家简单的了解了下RPC框架和Dubbo.接下来就是重点了,Dubbo的helloworld项目. 一.搭建项目 首先我们新建三个maven项目 ...
- Dubbo与SpringBoot整合流程(从实例入手,附代码下载)
场景 Dubbo环境搭建-管理控制台dubbo-admin实现服务监控: https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/10362 ...
- Dubbo--002--例子程序
虽然项目中用到了dubbo,还是想自己玩玩写个demo.百度一搜,关于dubbo的helloworld基本都是在windows上做的.现在在Linux上玩一下. 环境准备: jdk版本:1.7 服务器 ...
- Dubbox 环境搭建
第一章:Dubbox简介 Dubbox是一个开源的RPC(Remote ProcedureCall Protocol)远程调用框架,是由dangdang对阿里的Dubbo的升级,可以被视为Dubbo的 ...
- JMicro微服务Hello World
概述 JMicro是本人开发的基于Java实现的微服务框架,前两天发布0.0.3正式版本,并已发布到maven中央仓库. 项目源码github:https://github.com/mynewworl ...
- Dubbo源码-从HelloWorld开始
Dubbo简介 Dubbo,相信做后端的同学应该都用过,或者有所耳闻.没错,我就是那个有所耳闻中的一员. 公司在好几年前实现了一套自己的RPC框架,所以也就没有机会使用市面上琳琅满目的RPC框架产品. ...
- dubbo入门之helloWorld
dubbo官方文档:http://dubbo.apache.org/zh-cn/docs/user/quick-start.html 基于spring coloud的demo:http://start ...
- Dubbo学习笔记(一) 基础知识HelloWorld
Dubbo是由阿里巴巴研发出的一款基于Java实现的RPC框架,现由Apache进行维护管理,笔记中使用zookeeper作为注册中心,dubbo+zookeeper环境安装教程:https://ww ...
随机推荐
- ubuntu部署kubeadm1.13.1高可用
kubeadm的主要特性已经GA了,网上看很多人说1.13有bug在1.13.1进行的更新,具体我也没怎么看,有兴趣的朋友可以查查,不过既然有人提到了我们就不要再去踩雷了,就用现在的1.13.1来部署 ...
- VM虚拟机网卡LAN区段模拟内网使用教程
目录 1. 测试环境 2. 设置LAN区段并测试 2.1. 添加LAN区段 2.2. 在虚拟机中设置静态IP地址 2.3. 测试同一LAN区段的主机是否可以联通 2.4 ...
- python核心编程2 第十二章 练习
12–5. 使用 __import__().(a) 使用 __import__ 把一个模块导入到你的名称空间. 你最后使用了什么样的语法? (b) 和上边相同, 使用 __import__() 从指定 ...
- Ajax之404,200等查询
xmlhttp.readyState的值及解释: 0:请求未初始化(还没有调用 open()). 1:请求已经建立,但是还没有发送(还没有调用 send()). 2:请求已发送,正在处理中(通常现在可 ...
- 浅谈C#实现Web代理服务器的几大步骤
代理服务程序是一种广泛使用的网络应用程序.代理程序的种类非常多,根据协议不同可以分成HTTP代理服务程序.FTP代理服务程序等,而运行代理服务程序的服务器也就相应称为HTTP代理服务器和FTP代理服务 ...
- CentOS下安装pip
CentOS下安装pip 通常情况下使用命令: yum -y install pip 也有可能报错,无法安装.这是应该使用第二种方法. 1.首先需要先安装扩展源EPEL: yum -y install ...
- python3 练习题100例 (二十一)打印一定范围内的水仙花数
题目内容: 水仙花数是指一个n位数 (n≥3),它的每个位上的数字的n次幂之和等于它本身. 例如:153是一个“水仙花数”,因为 153 是个 3位数,而1**3+5**3+3**3==153. 输入 ...
- Go搭建一个Web服务器
package main import ( "fmt" "net/http" "strings" "log" ) fun ...
- Tensorflow之安装GPU版错误集合
在根据教程http://blog.csdn.net/sb19931201/article/details/53648615安装好全部的时候,却无情的给我抛了几个错: 1.AttributeEr ...
- HBase import tsv,csv File
一,HBase中创建table 表(liupeng:test)并创建 info ,contect 列簇 hbase(main):258:0> create "liupeng:Test& ...