spring MVC中Dubbo的配置
1、服务提供方的bubbo配置:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:task="http://www.springframework.org/schema/task"
xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-4.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
http://www.springframework.org/schema/task
http://www.springframework.org/schema/task/spring-task-4.0.xsd
http://code.alibabatech.com/schema/dubbo
http://code.alibabatech.com/schema/dubbo/dubbo.xsd"> <!-- 配置Dubbo提供方 -->
<!-- 配置提供方的名称即服务名 -->
<dubbo:application name="babasport-service-product"/> <!-- 配置注册中心 -->
<!-- 配置集群的zookeeper机器,address中间用逗号隔开,端口号在zookeeper的config文件中查看;protocol:协议为zookeeper
<dubbo:registry address="192.168.1.1:2181,192.168.1.2:2182" protocol="zookeeper"/> -->
<dubbo:registry address="192.168.1.110:2181" protocol="zookeeper"/> <!-- 设置端口号(服务提供方的), 若不设置则默认是20880 -->
<dubbo:protocol port="20880" name="dubbo"/> <!-- 暴露的接口 -->
<dubbo:service interface="cn.itcast.core.service.TestTbService" ref="testTbService"/> </beans>
2、服务的消费方配置:
<?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:mvc="http://www.springframework.org/schema/mvc"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:task="http://www.springframework.org/schema/task" xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-4.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
http://www.springframework.org/schema/task
http://www.springframework.org/schema/task/spring-task-4.0.xsd
http://code.alibabatech.com/schema/dubbo
http://code.alibabatech.com/schema/dubbo/dubbo.xsd"> <!-- Dubbo的消费方,消费方的名称 -->
<dubbo:application name="babasport-console"/> <!-- 注册中心 -->
<dubbo:registry address="192.168.1.110:2181" protocol="zookeeper"/> <!-- 获取接口及实现类 -->
<dubbo:reference interface="cn.itcast.core.service.TestTbService" id="testTbService"/> </beans>
注意:
使用Dubbo传递参数,该参数需要实现序列化。
spring MVC中Dubbo的配置的更多相关文章
- spring mvc中拦截器配置mvc:interceptors
其实在mvc:interceptors标签中,有两种类型的配置,一种直接配置一个bean(bean和ref归为一类),另一种还要配置上拦截的路径和排除的路径.直接配置的bean那就代表对所有的请求进行 ...
- spring mvc 中web.xml配置信息解释
在项目中总会遇到一些关于加载的优先级问题,近期也同样遇到过类似的,所以自己查找资料总结了下,下面有些是转载其他人的,毕竟人家写的不错,自己也就不重复造轮子了,只是略加点了自己的修饰. 首先可以肯定的是 ...
- spring mvc 中 controller 路径配置
下图中,由于红色部分(value="/")的存在,导致 host:port/项目/dimlist 无法被映射到dimList方法,解决办法是将其去掉. package cn.bgo ...
- spring mvc中使用freemark的一点心得
参考文档: FreeMarker标签与使用 连接http://blog.csdn.net/nengyu/article/details/6829244 freemarker学习笔记--指令参考: ht ...
- Spring MVC中处理静态资源的多种方法
处理静态资源,我想这可能是框架搭建完成之后Web开发的”头等大事“了. 因为一个网站的显示肯定会依赖各种资源:脚本.图片等,那么问题来了,如何在页面中请求这些静态资源呢? 还记得Spring MVC中 ...
- Spring MVC 中的基于注解的 Controller【转】
原文地址:http://my.oschina.net/abian/blog/128028 终于来到了基于注解的 Spring MVC 了.之前我们所讲到的 handler,需要根据 url 并通过 H ...
- spring mvc中的文件上传
使用commons-fileupload上传文件所需要的架包有:commons-fileupload 和common-io两个架包支持,可以到Apache官网下砸. 在配置文件spring-mvc.x ...
- Spring MVC中基于注解的 Controller
终于来到了基于注解的 Spring MVC 了.之前我们所讲到的 handler,需要根据 url 并通过 HandlerMapping 来映射出相应的 handler 并调用相应的方法以响 ...
- Spring MVC 中的 forward 和 redirect
Spring MVC 中,我们在返回逻辑视图时,框架会通过 viewResolver 来解析得到具体的 View,然后向浏览器渲染.假设逻辑视图名为 hello,通过配置,我们配置某个 ViewRes ...
随机推荐
- effective C++学习二(仅供个人学习记录,本文摘录effective C++)
条款 2:尽量用<iostream>而不用<stdio.h> scanf 和 printf 很轻巧,很高效,你也早就知道怎么用它们,这我承 认.但尽管他们很有用,事实上 sca ...
- UITableView性能的优化()
1.0 使用不透明视图 不透明的视图可以极大地提高渲染的速度. 2.0 不要重复创建不必要的cell 也就是我们常说的 循环利用机制 (建立缓冲池) 3.0 减少视图的数目 4.0 不要做多余的绘 ...
- CentOS添加环境变量
添加这个两个路径:/usr/local/webserver/python/bin:/usr/local/webserver/mysql/bin 方法一:直接运行命令export PATH=$PATH: ...
- tomcat 修改jdk版本号
set JAVA_OPTS=-Djute.maxbuffer=2048000 set console_log=true set CATALINA_OPTS=-server -Xdebug -Xnoag ...
- Excel批量修改文件
[1]把下图片放在一个文件目录下面,如E:\SVM_Class\airplanes [2]点击“开始”→“运行”(或按快捷键win+R),在弹出框中输入“cmd”,进入dos操作界面. [3]do ...
- metasploit framework(十一):获取漏洞信息
查看参数 这个模块运行需要一个session 所以需要先获取到一个session 就获得了一个session 再回到枚举补丁模块 添加session 查看参数看到session已经添加上去了 run ...
- 两种创建Observable的方法(转)
转自:http://blog.csdn.net/nicolelili1/article/details/52038211 Observable.create() create()方法使开发者有能力从头 ...
- V4 V7 V13支持包的区别(转)
三者均为支持包,可以让低版本系统使用高版本特性,支持最小版本有差异 V4支持1.6以上 V7支持2.1以上 V13支持3.2以上 V7依赖V4 转自:
- 网页性能优化:防止JavaScript、CSS阻塞浏览器渲染页面
网页中引用的外部文件: JavaScritp.CSS 等常常会阻塞浏览器渲染页面.假设在 <head> 中引用的某个 JavaScript 文件由于各种不给力需要2秒来加载,那么浏览器渲染 ...
- ORACLE的强制索引
在一些场景下,可能ORACLE不会自动走索引,这时候,如果对业务清晰,可以尝试使用强制索引,测试查询语句的性能. 以EMP表为例: 先在EMP表中建立唯一索引,如图. 普通搜索: SELECT * F ...