<?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. hibernate错误提示

    2016-05-03 09:45:03,275 -- WARN  -- org.hibernate.internal.util.xml.DTDEntityResolver.resolveEntity( ...

  2. H5非主体结构元素

    1.header元素:页面中一个内容区块或整个页面的标题: 具有引导和导航作用的结构元素,通常用来放置整个页面或页面内的一个内容区块的标题,也可以包含数据表格.搜索表单或相关的logo图片. 一个网页 ...

  3. Window 下安装Redis

    下载地址:https://github.com/dmajkic/redis/downloads. 下载到的Redis支持32bit和64bit.根据自己实际情况选择,将64bit的内容cp到自定义盘符 ...

  4. C语言变量声明加冒号的用法

    有些信息在存储时,并不需要占用一个完整的字节, 而只需占几个或一个二进制位.例如在存放一个开关量时,只有0和1 两种状态, 用一位二进位即可.为了节省存储空间,并使处理简便,C语言又提供了一种数据结构 ...

  5. awk 多分隔符

    #!/bin/bash log_path="./log/" dates=`date -d '-1 days' +'%Y%m%d'` cd $log_path; for i in ` ...

  6. python使用pyapns进行ios推送消息

    Pyapns 提供了通用的Apple Push Notification Service (APNS).该解决方案使用了开源的Twisted server,支持原生的Python和Ruby API. ...

  7. bzoj 2705: [SDOI2012]Longge的问题 歐拉函數

    2705: [SDOI2012]Longge的问题 Time Limit: 3 Sec  Memory Limit: 128 MBSubmit: 1035  Solved: 669[Submit][S ...

  8. Codeforces Round #206 (Div. 2)

    只会做三个题: A:简单题,不解释: #include<cstdio> using namespace std; int k,d; int main() { scanf("%d% ...

  9. h.264 去块滤波

    块效应及其产生原因 我们在观看视频的时候,在运动剧烈的场景常能观察到图像出现小方块,小方块在边界处呈现不连续的效果(如下图),这种现象被称为块效应(blocking artifact). 首先我们需要 ...

  10. sublime配置python开发

    想在sublime里要python shell那种交互或者run module F5 F5 F5下这种效果的话,还是挺容易实现的,windows下的:1. 打开Sublime text 3 安装pac ...