spring-remoting调用的介绍


1. 总体介绍

Spring目前提供了对HttpInvoker、Hessian、Burlap等Remoting技术的集成。
Spring屏蔽了这些实现技术的差异,用户只需开发简单的Java对象(Plain Old Java Objects,POJO)然后按照Spring规定的格式进行配置文件的编写即可,提高效率,而且几种调用方式之间可以平滑切换,只需要更改配置文件,不需要更改具体的代码。


对比介绍
名称技术语言
http invoker基于java序列化传输数据仅支持java
hessian基于二进制流传输数据跨语言,字节数少,性能较优
burlap基于xml传输数据跨语言,数据冗余,xml格式描述性好


2.客户端配置

<bean id="productServiceHessian" class="org.springframework.remoting.caucho.HessianProxyFactoryBean">
        <property name="serviceUrl" value="http://127.0.0.1:8300/productService.servicehessian"/>
        <property name="serviceInterface" value="com.xxxxx.biz.service.ProductService"/>
    </bean>
    
	 <bean id="productServiceBurlap" class="org.springframework.remoting.caucho.BurlapProxyFactoryBean">  
        <property name="serviceUrl" value="http://127.0.0.1:8300/productService.serviceburlap"/>
        <property name="serviceInterface" value="com.xxxxx.service.ProductService"/>
    </bean>


3. 服务端配置

<bean id="productService" class="com.xxxxx.service.impl.ProductServiceImpl"></bean>

<bean name="/productService.servicehessian" class="org.springframework.remoting.caucho.HessianServiceExporter">
        <property name="service" ref="productService" />
        <property name="serviceInterface" value="com.xxxxx.service.ProductService" />
    </bean>
    
	<bean name="/productService.serviceburlap" class="org.springframework.remoting.caucho.BurlapServiceExporter">
        <property name="service" ref="productService" />
        <property name="serviceInterface" value="com.xxxxx.service.ProductService" />
    </bean>


4. 单元测试

详细介绍见:http://blog.csdn.net/lsblsb/article/details/39930503

5. 其他

过程中遇到的小问题:

解决HessianProtocolException: expected string at 0x6d  : http://blog.csdn.net/lsblsb/article/details/39994461

关于spring的httpinvoker调用详细介绍见:http://blog.csdn.net/lsblsb/article/details/39930503

参考:http://www.iteye.com/topic/417767

java 几种远程服务调用协议的比较:http://www.360doc.com/content/12/0220/13/2795334_188038946.shtml

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值