1.在服务器端程序中的spring-servlet.xml中添加
<bean id="userService" class="org.springframework.remoting.rmi.RmiServiceExporter">
<property name="serviceName">
<value>UserService</value>
</property>
<property name="service">
<ref bean="userServiceImpl"/>
</property>
<property name="serviceInterface">
<value>com.life.service.UserService</value>
</property>
<property name="registryPort">
<value>1200</value>
</property>
</bean>
2)在客户端的spring-servlet.xml中添加
<bean id="userService" class="org.springframework.remoting.rmi.RmiProxyFactoryBean">
<property name="serviceUrl"><value>rmi://localhost:1200/UserService</value></property>
<property name="serviceInterface"><value>com.life.service.UserService</value></property>
</bean>
demo源码下载:http://pan.baidu.com/s/1ohM4e