Spring3 + RMI 整合
来源:互联网 发布:阿里云客服兼职 编辑:程序博客网 时间:2024/06/16 14:17
1、 创建接口和实现类
接口AmrServer需要同时提供给服务端端和客户端使用,实现类略
public interface AmrServer{ publicString createTask(List<?> bcl, String yhlx, String czyId,boolean htxf);}
2、 配置RMI服务端到Spring篇日志文件
可以直接通过RMI的blind的方式将接口直接绑定到服务上,若需要与spring整合,配置如下,id为registry的bean可以认为是RMI的注册工厂,amrServerExporter中的各个属性含义对应为:
service:提供服务的方法实现类对应的bean的id
serviceInterface:提供服务的接口
serviceName:用于客户端查找服务的名称
registry : 前文提到的注册工厂
<bean id="registry"class="org.springframework.remoting.rmi.RmiRegistryFactoryBean"> <propertyname="port" value="9764"></property></bean> <bean id="amrServer"class="com.zpepc.amr.rmi.app.server.AmrServerImpl"init-method="init"></bean><bean id="amrServerExporter"class="org.springframework.remoting.rmi.RmiServiceExporter"> <property name="service" ref="amrServer" /> <property name="serviceName" value="amrServer"/> <property name="serviceInterface"value="com.zpepc.amr.rmi.app.intf.AmrServer" /> <property name="registry" ref="registry" /></bean>
3、 配置RMI客户端
客户端首先需要前文提到的接口,然后在Spring配置文件中加入下文,即可将amrServer作为通常的bean注入到其他bean中使用
注:Spring2.5的property只需要配置serviceUrl和serviceInterface即可,另外三项Spring3必须配置
<bean id="amrServer"class="org.springframework.remoting.rmi.RmiProxyFactoryBean"> <propertyname="serviceUrl"value="rmi://10.136.34.118:9764/amrServer" /> <property name="serviceInterface"value="com.zpepc.amr.rmi.app.intf.AmrServer" /> <property name="lookupStubOnStartup"value="false"></property> <property name="refreshStubOnConnectFailure"value="true"></property> <property name="cacheStub"value="false"></property></bean>
0 0
- Spring3 + RMI 整合
- Spring3 rmi 实现
- Spring整合 RMI
- Spring整合RMI
- Spring整合 RMI
- Spring整合Rmi总结
- spring整合RMI
- Spring整合 RMI
- Spring整合 RMI
- Spring整合 RMI
- Spring整合RMI
- Spring整合 RMI
- MyBatis3整合Spring3、SpringMVC3
- struts2 spring3 hibernate3整合
- 整合Mybatis 与 Spring3
- MyBatis3整合Spring3、SpringMVC3
- Struts2+Spring3+Hibernate3整合
- Spring3 整合 Mybatis3
- 简易JS模板引擎
- 学习笔记——Retrofit2.0的简单使用
- vim E492: Not an editor command: ^M(使用VIM打开文件一直提示错误)
- SVN使用教程总结
- new内存失败后的正确处理
- Spring3 + RMI 整合
- UBUNTU 修改root密码
- 综合项目之乐学成语(显示所有动物类成语的列表)
- 计蒜之道2016 遗失的支付宝密码 解题报告
- Web自动化框架LazyUI使用手册(2)--先跑起来再说(第一个测试用例-百度搜索)
- 第十六周实践项目-阅读程序(1)
- 死锁
- android 图片上传的问题
- lock