暴露服务:
@SuppressWarnings("rawtypes") private <a target=_blank href="eclipse-open:%E2%98%82=api/C:%5C/Users%5C/Administrator%5C/.gradle%5C/caches%5C/modules-2%5C/files-2.1%5C/org.springframework%5C/spring-web%5C/3.2.8.RELEASE%5C/799ae0503da5a9f980fecd38c9e6b23a71a406c8%5C/spring-web-3.2.8.RELEASE.jar%3Corg.springframework.remoting.caucho(HessianServiceExporter.class%E2%98%83HessianServiceExporter"><img style="BORDER-BOTTOM: medium none; POSITION: absolute; BORDER-LEFT: medium none; WIDTH: 16px; HEIGHT: 16px; BORDER-TOP: medium none; BORDER-RIGHT: medium none; LEFT: -21px" alt="Open Declaration" src="file:/D:/qby/src/.metadata/.plugins/org.eclipse.jdt.ui/jdt-images/3.png" /> </a><a target=_blank class="header" href="eclipse-javadoc:%E2%98%82=api/C:%5C/Users%5C/Administrator%5C/.gradle%5C/caches%5C/modules-2%5C/files-2.1%5C/org.springframework%5C/spring-web%5C/3.2.8.RELEASE%5C/799ae0503da5a9f980fecd38c9e6b23a71a406c8%5C/spring-web-3.2.8.RELEASE.jar%3Corg">org</a>.<a target=_blank class="header" href="eclipse-javadoc:%E2%98%82=api/C:%5C/Users%5C/Administrator%5C/.gradle%5C/caches%5C/modules-2%5C/files-2.1%5C/org.springframework%5C/spring-web%5C/3.2.8.RELEASE%5C/799ae0503da5a9f980fecd38c9e6b23a71a406c8%5C/spring-web-3.2.8.RELEASE.jar%3Corg.springframework">springframework</a>.<a target=_blank class="header" href="eclipse-javadoc:%E2%98%82=api/C:%5C/Users%5C/Administrator%5C/.gradle%5C/caches%5C/modules-2%5C/files-2.1%5C/org.springframework%5C/spring-web%5C/3.2.8.RELEASE%5C/799ae0503da5a9f980fecd38c9e6b23a71a406c8%5C/spring-web-3.2.8.RELEASE.jar%3Corg.springframework.remoting">remoting</a>.<a target=_blank class="header" href="eclipse-javadoc:%E2%98%82=api/C:%5C/Users%5C/Administrator%5C/.gradle%5C/caches%5C/modules-2%5C/files-2.1%5C/org.springframework%5C/spring-web%5C/3.2.8.RELEASE%5C/799ae0503da5a9f980fecd38c9e6b23a71a406c8%5C/spring-web-3.2.8.RELEASE.jar%3Corg.springframework.remoting.caucho">caucho</a>.HessianServiceExporter buildHessianServiceExporter( Class serviceInterface, Object service) { HessianServiceExporter HessianServiceExporter = new HessianServiceExporter(); HessianServiceExporter.setServiceInterface(serviceInterface); HessianServiceExporter.setService(service); return HessianServiceExporter; } @Bean(name = "/helloService ") public HessianServiceExporter helloServiceExporter() { return buildHessianServiceExporter(HelloService .class, helloService ); } @Autowired private HelloService helloService ;
@Bean public HessianProxyFactoryBean helloService() { return buildHessianProxyFactoryBean(HelloService.class, "helloService"); } @SuppressWarnings("rawtypes") private HessianProxyFactoryBean buildHessianProxyFactoryBean( Class serviceInterface, String serviceName) { HessianProxyFactoryBean factory = new HessianProxyFactoryBean(); factory.setServiceInterface(serviceInterface); factory.setServiceUrl(hessianSererUrl + "/remoting/xxx/" + serviceName); return factory; }
public static void main(String[] args) throws Exception { HessianProxyFactory factory = new HessianProxyFactory(); xxxxx hello = (xxxxxx) factory.create( MgtResourceService.class, "http://localhost:12080/remoting/xxx/xxxxxx"); System.out.println(hello.findAll()); }
版权声明:本文为博主原创文章,未经博主允许不得转载。
原文地址:http://blog.csdn.net/bolg_hero/article/details/48023165