@Bean
public HessianServiceExporter hessianServiceExporterSpittrService(SpittrService spittrService){
HessianServiceExporter exporter = new HessianServiceExporter();
exporter.setService(spittrService);
exporter.setServiceInterface(SpittrService.class);
return exporter;
}
@Override
protected String[] getServletMappings() {
return new String[]{"/","*.service"};
}
@Bean
public HandlerMapping hessianMapping(){
SimpleUrlHandlerMapping mapping = new SimpleUrlHandlerMapping();
Properties mappings = new Properties();
mappings.setProperty("/spttr.service","hessianServiceExporterSpittrService");
mapping.setMappings(mappings);
return mapping;
}
@Bean
public HessianProxyFactoryBean spittrService(){
HessianProxyFactoryBean proxyFactoryBean = new HessianProxyFactoryBean();
proxyFactoryBean.setServiceUrl("http://localhost:8080/RpcServer/spttr.service");
proxyFactoryBean.setServiceInterface(SpittrService.class);
return proxyFactoryBean;
}
原文:https://www.cnblogs.com/-shing/p/b9e01a90b15829a5df18e88205e13bc1.html