Announcement Announcement Module
Collapse
No announcement yet.
Defining a new auto-proxy creator Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Defining a new auto-proxy creator

    Hi,

    I would like to expose services (classes that implement an interface called Service) using RMI. I can export them one by one using RmiServiceExporter, but in order to avoid bloating the XML config I'd like to have an auto-proxy creator that automatically creates an RMI service exporter for any bean implementing the Service interface.

    The manual way:
    Code:
    <!-- Service class -->
    class MyService1 implements Service { 
    ... 
    }
    
    <!-- Service config in Spring -->
    <bean id="MyService1Bean" class="mycompany.MyService1"/>
    
    <!-- Publish service using RMI -->
    <bean class="org.springframework.remoting.rmi.RmiServiceExporter">
    	<property name="serviceInterface" value="mycompany.MyService1" />
    	<property name="serviceName" value="MyService1" />
    	<property name="service" ref="MyService1Bean" />
    </bean>
    
    (repeat this for each service)
    How can this be replaced with a standard Spring auto proxy creating mechanism?

    Thanks,
    Peter

  • #2
    If you use Spring 2.5.x you could even define your own annotation for that. You could extend @Component or @Service and create a @RmiService annotation. Then create a BeanPostProcessor which knows what to do with it.

    You might want to take a look at the CommonAnnotationBeanPostProcessor and AutowireAnnotationBeanPostProcessor for some information. Also looking at the transcational stuff (@Transactional) might clear things.

    Comment

    Working...
    X