mardi 20 septembre 2016

How to export all services to rmi service without writing too many xmls in spring web project?

Now I have demand to export my all project services to rmi service.I know I can write xml configs to config every bean like below:

<bean class="org.springframework.remoting.rmi.RmiServiceExporter">  
 <property name="serviceName" value="AccountService"/>
  <property name="service" ref="accountService"/>
    <property name="serviceInterface" value="example.AccountService"/>
   <property name="registryPort" value="1199"/>
</bean>

As I have a lot of services layer to export, so I need write too many bean definitions.It waste time.I need to follow one ruler to generate beans.property as blow ruler: 1.serviceName is service name. 2.service is service implement class 3.serviceInterface is service interface.

My all service implement class use @Service annotation. can spring finish these: 1.scan all service implement class 2.iterate service implement class information ,to generate all beans like up template. to make it possible I only need to write a template xml or write nothing xml files.

Thx.

 

 





Aucun commentaire:

Enregistrer un commentaire