Spring配置之RMI

来源:互联网 发布:linux 守护进程程序 编辑:程序博客网 时间:2024/05/22 10:43
<?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:p="http://www.springframework.org/schema/p"
    xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
    http://www.springframework.org/schema/context
    http://www.springframework.org/schema/context/spring-context-3.0.xsd">

    <!-- spring rmi服务端配置 -->

    <bean id="cdeskService" class="com.cdesk.service.impl.CDeskService"></bean>
    <bean id="rmiServiceExporter_order" class="org.springframework.remoting.rmi.RmiServiceExporter">
        <property name="service" ref="cdeskService" />
        <!-- 定义服务名 -->
        <property name="serviceName" value="cdesk" />
        <!--接口类名 -->
        <property name="serviceInterface" value="com.cdesk.service.ICDeskService" />
        <!-- 端口号 -->
        <property name="registryPort" value="8888"></property>
        <!-- <property name="registryHost" value="localhost"></property> -->
    </bean>
    
    
    <!-- spring rmi客户端配置 -->
    <!-- 客户端的接口和服务端借口必须保持一模一样 -->
    <bean id="cdeskProxy" class="org.springframework.remoting.rmi.RmiProxyFactoryBean">
        <!-- baseService是调用服务端serviceName的value -->
        <property name="serviceUrl" value="rmi://192.168.0.10:8888/cdesk"></property>
        <!-- service接口 -->
        <property name="serviceInterface" value="com.cdesk.service.ICDeskService"></property>
    </bean>

</beans>