spring RMI应用
利用Spring来实现RMI,不用实现remote接口,也不用调用rmic编译stub和skeleton,
服务端可以定义org.springframework.remoting.rmi.RmiServiceExporter类完成RMI服务器实现.
客户端只要定义org.springframework.remoting.rmi.RmiProxyFactoryBean,告知rmi的url和接口
服务器实现:
接口:
IHello.java
服务端spring的配置:package com.callan.Test;import org.springframework.context.ApplicationContext;import org.springframework.context.support.FileSystemXmlApplicationContext;public class RMIClient {public static void main(String[] args) {ApplicationContext content = new FileSystemXmlApplicationContext("E:/workspace/rmiClient/src/applicationContext.xml");IHello iHello = (IHello)content.getBean("serviceClient");System.out.println(iHello.hello("callan"));}}
文章源自:http://callan.iteye.com/blog/162756