1、dubbo 有一个 dubbo.properties 作为默认配置

默认配置可以在不添加新的配置的前提下使用dubbo

dubbo.properties 的内容(来自 https://github.com/alibaba/dubbo)

2、dubbo 学习参考链接

·dubbo-admin管理控制台的安装和使用:http://www.cnblogs.com/aqsunkai/p/6690607.html

·dubbo官网,下载和配置说明:http://dubbo.io/

·dubbo结合Spring:http://blog.csdn.net/congcong68/article/details/41113239

·dubbo 配置 :http://www.cnblogs.com/linjiqin/p/5859153.html

·zookeeper 基本含义: http://blog.csdn.net/gyflyx/article/details/18652913

3、本地环境搭建-zookeeper(windows 环境)

http://blog.csdn.net/bestcxx/article/details/73440892

4、从github下载 dubbo 测试所需的几个工程

https://github.com/alibaba/dubbo

先全部下载,然后取其中的 dubbo-admin和dubbo-demo

dubbo-admin是dubbo监控平台,可以打包为war或者直接jetty运行(maven 配置 jetty 插件),启动后访问 http://localhost:9999/dubbo-admin 端口9999看你怎么定义了

需要输入用户名和密码:root/root

之后点击 返回首页

然后进入预期的界面了

dubbo-demo聚合了demo-api\demo-consumer\demo-provider

demo-api是接口,demo-proveider 实现了demo-api

demo-provider是提供者

demo-consumer是消费者

demo-provider和demo-consumer 都是在test中提供main方法启动,demo-consumer 一直调用,可以看到两个平台的交互

5、实验得出的结论

dubbo.properties 会起到默认配置的作用

但是 dubbo-demo-provider.xml 中的配置可以对dubbo.properties 的配置进行覆盖和扩展(这意味着某些配置不是必须的)

dubbo-demo-provider.xml 的内容(DemoTwoServiceImpl.java 和 DemoTwoService.java 是新增的两个类,分别加在dubbo-provider 和 dubbo-api中,参照先例即可)

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. - Copyright 1999-2011 Alibaba Group.
  4. -
  5. - Licensed under the Apache License, Version 2.0 (the "License");
  6. - you may not use this file except in compliance with the License.
  7. - You may obtain a copy of the License at
  8. -
  9. -      http://www.apache.org/licenses/LICENSE-2.0
  10. -
  11. - Unless required by applicable law or agreed to in writing, software
  12. - distributed under the License is distributed on an "AS IS" BASIS,
  13. - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. - See the License for the specific language governing permissions and
  15. - limitations under the License.
  16. -->
  17. <beans xmlns="http://www.springframework.org/schema/beans"
  18. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  19. xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
  20. xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
  21. http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
  22. <!-- bean的声明和Spring无差异 -->
  23. <bean id="demoService" class="com.alibaba.dubbo.demo.provider.DemoServiceImpl" />
  24. <bean id="demoTwoService" class="com.alibaba.dubbo.demo.provider.DemoTwoServiceImpl" />
  25. <!-- 由于dubbo.propertirs 的存在,可以直接配置 <dubbo:service>对外暴露服务,即存在默认的配置, -->
  26. <dubbo:service interface="com.alibaba.dubbo.demo.DemoTwoService" ref="demoTwoService" group="dubbodemoregister2"/>
  27. <!-- 如果需要使用个性化配置,则需要单独配置,比如服务提供者协议配置、注册中心配置 、服务提供者缺省值配置-->
  28. <!-- 服务提供者协议配置-dubbo会覆盖dubbo.properties: -->
  29. <!-- <dubbo:protocol id="dubbodemo" name="dubbo" port="20882"/> -->
  30. <!-- 注册中心配置-会覆盖 dubbo.proerties,这个本质就是 dubbo:service的group: -->
  31. <dubbo:registry id="dubbodemoregister" address="zookeeper://127.0.0.1:2181" protocol="dubbo"/>
  32. <dubbo:registry id="dubbodemoregister2" address="zookeeper://127.0.0.1:2181" protocol="dubbo"/>
  33. <!-- 服务提供者缺省值配置-所有服务提供者自动拥有此配置-这意味着,这个配置一个就够了: -->
  34. <!-- <dubbo:provider id="dubbodemoprovider" group="dubbodemoregister" timeout="30000" retries="0"/> -->
  35. <!-- 服务提供者暴露服务配置: -->
  36. <dubbo:service interface="com.alibaba.dubbo.demo.DemoService" ref="demoService" group="dubbodemoregister"/>
  37. </beans>
<?xml version="1.0" encoding="UTF-8"?>
<!--
- Copyright 1999-2011 Alibaba Group.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-->
<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-2.5.xsd
http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
&lt;!-- bean的声明和Spring无差异 --&gt;
&lt;bean id="demoService" class="com.alibaba.dubbo.demo.provider.DemoServiceImpl" /&gt;
&lt;bean id="demoTwoService" class="com.alibaba.dubbo.demo.provider.DemoTwoServiceImpl" /&gt; &lt;!-- 由于dubbo.propertirs 的存在,可以直接配置 &lt;dubbo:service&gt;对外暴露服务,即存在默认的配置, --&gt;
&lt;dubbo:service interface="com.alibaba.dubbo.demo.DemoTwoService" ref="demoTwoService" group="dubbodemoregister2"/&gt; &lt;!-- 如果需要使用个性化配置,则需要单独配置,比如服务提供者协议配置、注册中心配置 、服务提供者缺省值配置--&gt;
&lt;!-- 服务提供者协议配置-dubbo会覆盖dubbo.properties: --&gt;
&lt;!-- &lt;dubbo:protocol id="dubbodemo" name="dubbo" port="20882"/&gt; --&gt; &lt;!-- 注册中心配置-会覆盖 dubbo.proerties,这个本质就是 dubbo:service的group: --&gt;
&lt;dubbo:registry id="dubbodemoregister" address="zookeeper://127.0.0.1:2181" protocol="dubbo"/&gt;
&lt;dubbo:registry id="dubbodemoregister2" address="zookeeper://127.0.0.1:2181" protocol="dubbo"/&gt; &lt;!-- 服务提供者缺省值配置-所有服务提供者自动拥有此配置-这意味着,这个配置一个就够了: --&gt;
&lt;!-- &lt;dubbo:provider id="dubbodemoprovider" group="dubbodemoregister" timeout="30000" retries="0"/&gt; --&gt; &lt;!-- 服务提供者暴露服务配置: --&gt;
&lt;dubbo:service interface="com.alibaba.dubbo.demo.DemoService" ref="demoService" group="dubbodemoregister"/&gt;

</beans>

dubbo 部分 配置的关系-dubbo github 官方案例的更多相关文章

  1. Dubbo的配置及使用

    1. Dubbo是什么? Dubbo是一个分布式服务框架,致力于提供高性能和透明化的RPC远程服务调用方案,以及SOA服务治理方案.简单的说,dubbo就是个服务框架,如果没有分布式的需求,其实是不需 ...

  2. 【基础配置】Dubbo的配置及使用

    1. Dubbo是什么? Dubbo是一个分布式服务框架,致力于提供高性能和透明化的RPC远程服务调用方案,以及SOA服务治理方案.简单的说,dubbo就是个服务框架,如果没有分布式的需求,其实是不需 ...

  3. dubbo和zookeeper的关系

    转载前言:网络上很多教程没有描述zookeeper和dubbo到底是什么关系.分别扮演了什么角色等信息,都是说一些似是而非的话,这里终于找到一篇文章,比较生动地描述了注册中心和微服务框架之间的关系,以 ...

  4. dubbo基础(初学习dubbo)

    1. 扩展   Soap是webService协议.是http+xml. Rest ful是http+json.相对于soap来说rest ful就是轻量的,因为==.   Rpc与soa区别? Rp ...

  5. Dubbo系列(一)dubbo的产生背景与原理概述

    一.Dubbo框架的产生背景        大规模服务化之前,应用只是通过RMI或Hessian等工具,简单的暴露和引用远程服务,通过配置服务的URL地址进行调用,通过F5等硬件进行负载均衡. (1) ...

  6. dubbo高级配置学习

    启动时检查 可以通过check="false"关闭检查,比如,测试时,有些服务不关心,或者出现了循环依赖,必须有一方先启动. 关闭某个服务的启动时检查:(没有提供者时报错) < ...

  7. dubbo高级配置学习(上)

    启动时检查 Dubbo缺省会在启动时检查依赖的服务是否可用,不可用时会抛出异常,阻止Spring初始化完成,以便上线时,能及早发现问题,默认check=true. 如果你的Spring容器是懒加载的, ...

  8. dubbo简单配置与使用

    dubbo简介 随着互联网的发展,网站应用的规模不断扩大,常规的垂直应用架构已无法应对,分布式服务架构以及流动计算架构势在必行,亟需一个治理系统确保架构有条不紊的演进. 单一应用架构 当网站流量很小时 ...

  9. spring 5.x 系列第16篇 —— 整合dubbo (代码配置方式)

    文章目录 一. 项目结构说明 二.项目依赖 三.公共模块(dubbo-ano-common) 四. 服务提供者(dubbo-ano-provider) 4.1 提供方配置 4.2 使用注解@Servi ...

随机推荐

  1. BindingResult不能获取错误对象

    BindingResult不能获取错误对象,代码如下: @RequestMapping(value = "/login") public String error4( Model ...

  2. C#中的IEnumerable<T>知识点

    1.扩展IEnumerable<T>的方法 使继承了IEnumeralbe<T>的接口有了MyS方法 static class MySum {                  ...

  3. BA--暖通系统常见设计细节要点

    (一)系统设计问题 1.水泵在系统的设计位置: 一般而言,冷冻水泵应设在冷水机组前端,从末端回来的冷冻水经过冷冻水泵打回冷水机组:冷却水泵设在冷却水进机组的水路上,从冷却塔出来的冷却水经冷却水泵打回机 ...

  4. 解决VTune错误PMU resources currently being used by another profiling tool or process

    错误信息: When I ran Hardware Event-based Sampling Analysis 0, it showed the ERROR: Collection failed Co ...

  5. http格式(graph)

    http请求格式 http请求头 字段 http响应 http响应头字段

  6. 【数字图像处理】六.MFC空间几何变换之图像平移、镜像、旋转、缩放具体解释

    本文主要讲述基于VC++6.0 MFC图像处理的应用知识,主要结合自己大三所学课程<数字图像处理>及课件进行解说,主要通过MFC单文档视图实现显示BMP图片空间几何变换.包含图像平移.图形 ...

  7. Ant批量处理jmeter脚本

    Ant是一个可以把代码从某个地方拿来,编译,再拷贝到某个地方去的构建工具.一时冲动学习一下,顺便王婆卖瓜尝试着处理jmeter的脚本,于是,采坑之旅也从此开始.本文省略ant安装步骤和ant脚本说明, ...

  8. 利用js在文本框末尾获得焦点

    function moveEnd(obj) { obj.focus(); var len = obj.value.length; if (document.selection) { var sel = ...

  9. Spring经常使用属性的注入及属性编辑器

    对于对象的注入,我们使用ref方式,能够指定注入的对象.以下看下对于基本类型的注入.以及当spring无法转换基本类型进行注入时,怎样编写一个相似转换器的东西来完毕注入. 一.基本类型的注入 以下写一 ...

  10. ShareREC for iOS v1.0.4 已经公布

    ShareREC for iOS v1.0.4 已经公布 版本号:v1.0.4 2015-3-13 1.新增视频列表的筛选排序功能 2.修复在開始录制后,没有调用结束录制直接进入社区崩溃问题 3.优化 ...