Spring 集成 RMI
Maven
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-remoting</artifactId>
</dependency>
服务端
<?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:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.2.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.2.xsd"> <bean id="hello" class="org.zln.bdrisk.col.HelloImpl"/> <bean class="org.springframework.remoting.rmi.RmiServiceExporter">
<!-- RMI服务名称,可自定义服务名称 -->
<property name="serviceName" value="helloService" />
<!-- 导出实体 -->
<property name="service" ref="hello" />
<!-- 导出接口 -->
<property name="serviceInterface" value="org.zln.bdrisk.col.IHello" />
<!-- spring默认使用1099端口 -->
<property name="registryPort" value="8888" />
</bean> </beans>
客户端
<?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:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.2.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.2.xsd"> <bean id="hello" class="org.springframework.remoting.rmi.RmiProxyFactoryBean">
<property name="serviceUrl" value="rmi://localhost:8888/helloService" />
<property name="serviceInterface" value="org.zln.bdrisk.col.IHello" />
</bean>
</beans>
说明:服务端只有Spring实例化了,RMI服务对象就会注册好等着被调用,客户端上填写好服务端的地址和服务名,然后从Spring容器中获取远程对象即可
RMI与Spring集成后,编写RMI服务类和普通的接口、实现没有区别,不再需要集成、跑出指定异常等
RMI的限制:1、客户端和服务端都必须是Java 2、对地址、端口的依赖
Spring 集成 RMI的更多相关文章
- Spring集成RMI实现远程调用
前提: 1.开发工具: jdk tomcat ecplise,开发工具的使用本篇不做介绍. 2.需具备以下知识:javase servelt web rmi spring maven 一.关于RMI ...
- Spring与RMI集成实现远程访问
使用spring对RMI的支持,可以非常容易地构建你的分布式应用.在服务端,可以通过Spring的org.springframework.remoting.rmi.RmiServiceExporter ...
- 【Java Web开发学习】Spring发布RMI服务
[Java 远程服务]Spring发布RMI服务 转载:https://www.cnblogs.com/yangchongxing/p/9084066.html RmiServiceExporter可 ...
- 从零开始学 Java - Spring 集成 Memcached 缓存配置(二)
Memcached 客户端选择 上一篇文章 从零开始学 Java - Spring 集成 Memcached 缓存配置(一)中我们讲到这篇要谈客户端的选择,在 Java 中一般常用的有三个: Memc ...
- 从零开始学 Java - Spring 集成 ActiveMQ 配置(一)
你家小区下面有没有快递柜 近两年来,我们收取快递的方式好像变了,变得我们其实并不需要见到快递小哥也能拿到自己的快递了.对,我说的就是类似快递柜.菜鸟驿站这类的代收点的出现,把我们原来快递小哥必须拿着快 ...
- 【转】Dubbo使用例子并且和Spring集成使用
一.编写客户端和服务器端共用接口类1.登录接口类public interface LoginService { public User login(String name, String psw ...
- 从零开始学 Java - Spring 集成 Memcached 缓存配置(一)
硬盘和内存的作用是什么 硬盘的作用毫无疑问我们大家都清楚,不就是用来存储数据文件的么?如照片.视频.各种文档或等等,肯定也有你喜欢的某位岛国老师的动作片,这个时候无论我们电脑是否关机重启它们永远在那里 ...
- axis2+spring集成
转载自:http://www.cnblogs.com/linjiqin/archive/2011/07/05/2098316.html 1.新建一个web project项目,最终工程目录如下: 注意 ...
- rabbitMQ第五篇:Spring集成RabbitMQ
前面几篇讲解了如何使用rabbitMq,这一篇主要讲解spring集成rabbitmq. 首先引入配置文件org.springframework.amqp,如下 <dependency> ...
随机推荐
- ASP.NET检测到有潜在危险的 Request.Form 值解决方案汇总
ASP.NET检测到有潜在危险的 Request.Form 值解决方案汇总 当我们在网站中使用CKEditor等富文本编辑器时,大多都会遇到这样的到警告 这是因为ASP.NET默认开启对页面提交内容的 ...
- compass制作sprite雪碧图
1.安装compass.(需要先安装ruby) 命令行:gem install compass 2.新建一个compass 项目 命令行:compass create myproject 3.在myp ...
- bootstrap 学习笔记
bootstrap作为当下的流行框架不知道它怎么能行呢? 之前也看过好多bootstrap的网上教程,可是发现光看真的记不住,说起来也真是忧桑~重点还是要自己做才是真正的印象深刻.后来我发现解析模板是 ...
- RGui的http代理设置
办公电脑环境需要http代理访问大网,使用R语言安装包时老是无法连接网络,后来从网上发现解决方法很简单,只需在启动RGui.exe的命令行上加上启动参数就可以了. "C:\Program F ...
- i++是否原子操作
i++是否原子操作 不是原子操作.理由: 1.i++分为三个阶段: 内存到寄存器 寄存器自增 回内存 这三个阶段中间都可以被中断分离开. 2.++i首先要看编译器是怎么编译的, 某些编译器比如VC在 ...
- iOS 自动布局详细介绍
1. 自动布局的理解 iOS自动布局很有用,可以在不同size的屏幕上运行,原先看的头痛,还是习惯用最蠢的[UIScreen mainScreen].bounds.size.width等来布局,后来实 ...
- IOS UILabel 根据内容自适应高度
iOS Label 自适应高度 适配iOS7以后的版本 更多 self.contentLabelView = [[UILabel alloc] init]; self.contentLabelVie ...
- NSDate,NSNumber,NSValue
NSDate #import <Foundation/Foundation.h> int main(int argc, const char * argv[]) { @autoreleas ...
- Android网络编程只局域网传输文件
Android网络编程之局域网传输文件: 首先创建一个socket管理类,该类是传输文件的核心类,主要用来发送文件和接收文件 具体代码如下: package com.jiao.filesend; im ...
- 多选按钮(CheckBox)
今天我们介绍的是Checkbox多选框: 1.Activity //复选框,[基础控件]---状态切换控件CompoundButton及其子类CheckBox.RadioButton.ToggleBu ...