Announcement Announcement Module
Collapse
No announcement yet.
Accessing Remote Beans Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Accessing Remote Beans

    Bean A would like to use Bean B remotely.(say RMI)

    Bean B uses Bean C locally.

    So we have remote dependeny of A on B
    And Bean B locally on C.

    Context file for A will have definitions of A and B
    Context file for B will have definitons of C

    How do i define the above beans in 2 separate context files assuming that Bean A wants to use RMI to access B

    Can someone show how the above 2 context files look like?

  • #2
    This is largely based on the RMI example from the reference manual:
    Code:
    <bean id="objectA" class="example.classAImpl">
      <property name="objectB">
        <bean class="org.springframework.remoting.rmi.RmiProxyFactoryBean">
          <property name="serviceInterface" value="example.classB"/>
          <property name="serviceUrl" value="rmi://HOST:1199/ObjectBService"/>
        </bean>
      </property>
    </bean>
    Code:
    <bean id="objectC" class="example.classCImpl"/>
    <bean id="objectB" class="example.classBImpl">
      <property name="objectC" ref="objectC"/>
    </bean>
    
    <bean class="org.springframework.remoting.rmi.RmiServiceExporter">
    	<!-- does not necessarily have to be the same name as the bean to be exported -->
    	<property name="serviceName" value="ObjectBService"/>
    	<property name="service" ref="objectB"/>
    	<property name="serviceInterface" value="example.objectB"/>
    	<!-- defaults to 1099 -->
    	<property name="registryPort" value="1199"/>
    </bean>

    Comment

    Working...
    X