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> ...
随机推荐
- Setting up your App domain for SharePoint 2013
from:http://sharepointchick.com/archive/2012/07/29/setting-up-your-app-domain-for-sharepoint-2013.as ...
- Force.com微信开发系列(四)申请Access Token及自定义菜单之创建菜单
在微信接口开发中,许多服务的使用都离不开Access Token,Access Token相当于打开这些服务的钥匙,正常情况下会在7200秒内失效,重复获取将导致上次获取的Token失效,本文将首先介 ...
- android在Data目录内置可删除的APP
一.准备工作:make_ext4fs.mkuserimg.sh.simg2img,把它们跟要修改的 .img.ext4(或.img)文件放置到同一个目录下 二.转换源文件为img格式( .img则略过 ...
- 【读书笔记】iOS-头文件导入-@class注意事项
一,导入头文件有两种不同的方法:使用引号或者使用尖括号,例如,#import <Cocoa/Cocoa.h>和#import "Tire.h".带尖括号的语句是用来导入 ...
- 异步get请求之代理方法
#import "ViewController.h" #import "Header.h" @interface ViewController ()<NS ...
- Python学习 windows下面安装Python和pip(一)
windows下面安装Python和pip 安装Python 第一步,我们先来安装Python, https://www.python.org/downloads/ 这里选择的是2.7.10 第二步. ...
- 在js中获取get参数(仿PHP)
复制粘贴即可..然后就可以在js中像PHP用$_GET['name']这样子获取get参数了!! /*--------------------(返回 $_GET 对象, 仿PHP模式)-------- ...
- Android keystore 密码忘记了的找回办法
keystore密码忘记了,准备给自己的应用发布一个新版本,在apk打包时,发现之前的用的keystore密码忘了.如果换一个keystore,则之前已经安装应用的用户就必须手工卸载原应用才能安装,非 ...
- html列表
有序列表 <ol type="A", start="C"> <!--ordered list--> <li>第一项</ ...
- linux: 获取监听指定端口的进程PID
在 linux 下经常需要杀死(重启)监听某端口的进程, 因此就写了一个小脚本, 通过 ss 命令获取监听制定端口的进程 PID, 然后通过 kill 命令结束掉进程: #!/bin/sh # set ...