<?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. WinpCap 使用线程发数,明明发了,返回值0是OK的啊,怎么抓包看不到,难道不支持多线程。。。

    if (!m_adapterHandle){    return false;}int rst = pcap_sendpacket((pcap_t*)m_adapterHandle,data ,dat ...

  2. XML&DTD&XML Schema学习

    XML(eXtensible Markup Language)可扩展的标记语言.xml在web service编程中尤为重要.在网络传输中可以作为传输数据的载体.xml作为元语言,它可以用来标记数据. ...

  3. (转)Android 从底层实现让应用杀不死【失效Closed】(1)

    转自:http://klob.diandi.life/?p=21#symple-tab-%e8%b0%83%e6%9f%a5%e5%af%b9%e8%b1%a1 情景还原: 我的应用调用了Notifi ...

  4. bootstrap上传表单的时候上传的数据默认是0 一定要小心

    bootstrap上传表单的时候上传的数据默认是0 一定要小心

  5. php 常用几个函数

    function foo($arg){    $arg_num = func_num_args(); // 获取函数参数的个数    $args = func_get_args();    // 获取 ...

  6. linux 的一些 不常见的指标

    1. linux 的理论 最大用户数   2^32 -1   数据来源  linux就是这个范 (没验证) 2. mv 竟然不能修改文件更新时间

  7. Win7下通过easyBCD引导安装Ubuntu14.04

    Ubuntu14.04作为目前最新版本的ubuntu系统,相信很多人都想在自己的电脑上安装一下,然而系统的安装方法各式各样,u盘法.grub引导法等等,这里我将介绍在win7系统下用easyBCD软件 ...

  8. ubuntu下mysql安装与测试

    原文地址: http://www.cnblogs.com/zhuyp1015/p/3561470.html 注意:原文地址中,最后g++ 编译源代码时少了个字母.添上即可. ubuntu上安装mysq ...

  9. .Net Remoting浅释

    面试的时候,被问到.Net Remoting 工作方式及它和Web Service的区别,在此做个整理,顺便回顾一下. .Net Remoteing: 我们可以认为.Net Remoting是一种分布 ...

  10. spring- properties 读取的五种方式

    转至:http://www.cnblogs.com/hafiz/p/5876243.html 方式1.通过context:property-placeholder加载配置文件jdbc.properti ...