Saturday, 4 April 2015

Remote Service with RMI Annotation



I made Remote Service with RMI and xml configuration It works good ,but I need to change xml configuration to annotation


This is xml configuration



<bean class="org.springframework.remoting.rmi.RmiServiceExporter">
<property name="serviceName" value="mapMatchService" />
<property name="service" ref="mapMatchService" />
<property
name="serviceInterface"value="se.fmc.mm.remotingserver.MapMatchService"/>
<property name="registryPort" value="1099" />
</bean>


I changed it to annotation by the following class



@Configuration
public class ServerConfig {

@Bean
public RmiServiceExporter registerService(MapMatchService mapMatchService) {
RmiServiceExporter rmiServiceExporter = new RmiServiceExporter();
rmiServiceExporter.setServiceName("mapMatchService");
rmiServiceExporter.setService(mapMatchService);
rmiServiceExporter.setServiceInterface(MapMatchingService.class);
rmiServiceExporter.setRegistryPort(1099);

return rmiServiceExporter;
}


but It didn't run ,Should I need to add anything?


No comments:

Post a Comment