<?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">

 <!-- 引入spring配置 --> <import resource="applicationContext.xml" /> <!-- 具体服务实现bean --> <bean id="userService" class="com.xxx.user.service.impl.UserServiceImpl" /> <!-- 将服务service封装成可以对外开放的服务, 同时提供负载均衡算法,loadbalance可选有random,roundrobin(轮询) -->    <!--service中加入   mock="return null"当service所有都挂掉以后,client调用时自动获取到return null -->    <!--service中加入 actives="10" 表示限制所有服务在每个客户端调用都不能同时超过10个 -->    <!--service中加入  executes="10" 表示限制所有服务在每个服务器端被调用都不能同时超过10个 -->    <!-- 可以在service中加入内部标签   <dubbo:method name="sayHello" actives="10" />来控制每个方法的执行并发个数 -->    <!-- timeout="300" retry="2" 超时时间300    重试2次 -->    <!-- owner=”WangHeping,Guoyong”该服务的负责人 --> <dubbo:service interface="com.xxx.user.service.IUserService" ref="userService" loadbalance="roundrobin" /> <!-- 提供方应用信息,用于计算依赖关系,不要与消费方一样 --> <dubbo:application name="MyFirstDubboProvider" /> <!-- 使用multicast广播注册中心暴露服务地址 <dubbo:registry address="multicast://224.5.6.7:1234"         /> -->    <!-- 使用zookeeper注册中心暴露服务地址 --> <dubbo:registry address="zookeeper://192.168.1.244:2181" /> <!-- 用dubbo协议在20880端口暴露服务 ,注意不能与其他服务端口相同  -->    <!-- dispatcher all所有请求都发到线程池处理,threadpool fixed固定线程池大小,初始化后不进行伸缩,threads 线程池内线程个数 -->    <!-- <dubbo:protocol accesslog="true" />开启访问日志记录 -->    <!-- <dubbo:protocol accesslog="http://10.20.160.198/wiki/display/dubbo/foo/bar.log" />规定访问日志的路径 -->    <!-- <dubbo:protocol name="dubbo" connections="2" accepts="1000"/> dubbo协议使用长连接和nio,这里connections=2表示同时建立两个长连接(要在provier和consumer同时写上)        accepts=1000  表示为了防止同时过来大量连接而被干掉,限制最大为1000--> <dubbo:protocol name="dubbo" port="20880" dispatcher="all" threadpool="fixed" threads="100" />

</beans>

Dubbo xml配置 和注解配置 写法的更多相关文章

  1. Spring MVC 5 + Thymeleaf 基于Java配置和注解配置

    Spring MVC 5 + Thymeleaf 注解配置 Spring的配置方式一般为两种:XML配置和注解配置 Spring从3.0开始以后,推荐使用注解配置,这两种配置的优缺点说的人很多,我就不 ...

  2. Spring介绍及配置(XML文件配置和注解配置)

    本节内容: Spring介绍 Spring搭建 Spring概念 Spring配置讲解 使用注解配置Spring 一.Spring介绍 1. 什么是Spring Spring是一个开源框架,Sprin ...

  3. SpringMVC基础配置(通过注解配置,非xml配置)

    SpringMVC是什么,有多火,我这里就不再啰嗦了,SpringMVC比Struts2好用太多,我在学校的时候私下里两种都接触过,对比之后果断选择了SpringMVC,后来在做Android应用开发 ...

  4. 关于什么是SpringMVC,和SpringMVC基于xml配置、注解配置、纯注解配置

    首先我们先要了解一下,什么是SpringMVC? SpringMVC是Spring框架内置的MVC的实现.SpringMVC就是一个Spring内置的MVC子框架,也就是说SpringMVC的相关包都 ...

  5. Spring系列(四):Spring AOP详解和实现方式(xml配置和注解配置)

    参考文章:http://www.cnblogs.com/hongwz/p/5764917.html 一.什么是AOP AOP(Aspect Oriented Programming),即面向切面编程, ...

  6. springAop:Aop(Xml)配置,Aop注解配置,spring_Aop综合案例,Aop底层原理分析

    知识点梳理 课堂讲义 0)回顾Spring体系结构 Spring的两个核心:IoC和AOP 1)AOP简介 1.1)OOP开发思路 OOP规定程序开发以类为模型,一切围绕对象进行,OOP中完成某个任务 ...

  7. java:Springmvc框架1(基本配置,注解配置,转换器引入)

    1.springmvc01:(基本配置) web.xml: <?xml version="1.0" encoding="UTF-8"?> <w ...

  8. Hibernate配置(通过注解配置)

    本文主要讲通过注解配置来替换Hibernate的映射文件 1.多对一配置 package com.jazz7.entity; import java.util.Date; import javax.p ...

  9. spring-AOP动态代理,以及aspectJ的xml配置或注解配置方法,各个拦截器的使用顺序

    package com.itheima.aspect; public class MyAspect { public void check_Permissions(){ System.out.prin ...

随机推荐

  1. Lucene5.x 中文 同义词

    查询好好多资料,英文同义词好好的,中文就不行,多谢网友支持,拼接了好多代码,然后修改了一些,不足之处,多谢指正. 直接上代码吧,在代码中了解怎么分词的最好 1,创建分词引擎 public interf ...

  2. cocos2dx 实现不一样的ScrollView

    原来在公司被迫加班加点赶工,用lua实现的版本:http://www.cnblogs.com/mmc1206x/p/4146911.html 后来因我个人的需要, 用C++实现了一个版本. 蓦然回首, ...

  3. 细介Nigix配置与反向代理

    Nginx(发 音同 engine x)是一款轻量级的Web 服务器/反向代理服务器及电子邮件(IMAP/POP3)代理服务器,并在一个BSD-like 协议下 发行.由俄罗斯的程序设计师Igor S ...

  4. .net 对配置文件内容的操作

    配置文件分为两种 :一种是winform应用程序的配置文件, 一种是web的配置文件. 两种配置文件最大的区别是web的配置文件更新之后会时时更新, 应用程序的配置文件不会实时更新. 更新应用程序的配 ...

  5. 谈memcache和memcached的区别

    用了段时间的memcache和memcached总结下认识,看很多人在用cache的时候,刚刚都没有搞清楚memcache 和 memcached的区别,还有就是使用的时候基本都是 get/set   ...

  6. CodeIgniter框架介绍

    入口 index.php :一些路径常量定义: => CodeIgniter.php : 1. 初始化一些 system/core内的类,例如Config, Utf8, URI 和Router等 ...

  7. C# Winform开发框架企业版V4.0新特性

    企业版V4.0 - 新特性 C/S系统开发框架-企业版 V4.0 (Enterprise Edition) 简介: http://www.csframework.com/cs-framework-4. ...

  8. pyqt5 窗体布局

    窗体布局 1使用qtdesigner新建一个对话框,然后拖放几个按钮和文本框,按钮使用水平布局,效果如下: 鼠标选中水平布局再选中文本框,进行垂直布局,如下: 垂直布局后的效果如下: 然后,如何让窗体 ...

  9. C#错误与异常处理

    C# 提供了几个关键字(try.catch 和 finally),程序可以用这些关键字检测异常.处理异常并继续运行.这些关键字是让应用程序更可靠的非常有用的工具. class tryAndCatch ...

  10. Android应用自杀和干掉其它进程

    // 自杀(这种方式只能杀掉自己的进程,其它进程无法杀死) int pid = Process.myPid(); android.os.Process.killProcess(pid); // 或者 ...