zoukankan      html  css  js  c++  java
  • SpringMVC使用HttpInvoker发布远程服务

    参考这篇文章https://www.cnblogs.com/fanqisoft/p/10283156.html

    将提供者配置类中的

    1     @Bean
    2     public HessianServiceExporter hessianExporterUserService(UserService userService){
    3         HessianServiceExporter hessianServiceExporter = new HessianServiceExporter();
    4         hessianServiceExporter.setService(userService);
    5         hessianServiceExporter.setServiceInterface(UserService.class);
    6         return hessianServiceExporter;
    7     }

    替换为

    1     @Bean
    2     public HttpInvokerServiceExporter httpExporterUserService(UserService userService){
    3         HttpInvokerServiceExporter exporter = new HttpInvokerServiceExporter();
    4         exporter.setService(userService);
    5         exporter.setServiceInterface(UserService.class);
    6         return exporter;
    7     }

    将服务消费者

    1     @Bean
    2     public HessianProxyFactoryBean userService(){
    3         HessianProxyFactoryBean proxy = new HessianProxyFactoryBean();
    4         proxy.setServiceUrl("http://localhost:8081/SpringRmiService_war_exploded/user.service");
    5         proxy.setServiceInterface(UserService.class);
    6         return proxy;
    7     }

    替换为

    1     @Bean
    2     public HttpInvokerProxyFactoryBean userService(){
    3         HttpInvokerProxyFactoryBean proxy = new HttpInvokerProxyFactoryBean();
    4         proxy.setServiceUrl("http://localhost:8081/SpringRmiService_war_exploded/user.service");
    5         proxy.setServiceInterface(UserService.class);
    6         return proxy;
    7     }
  • 相关阅读:
    不可重叠最长重复子串
    离散化
    hash是一门优雅的暴力
    Detect the Virus (字符串转化+AC自动机)
    病毒侵袭(AC自动机变形)
    hdu2069(Coin Change)
    Hie with the Pie(poj3311)
    poj3254(状压dp入门第一道题,很详细)
    map系统学习
    ACM-ICPC 2018 南京赛区网络预赛 B. The writing on the wall
  • 原文地址:https://www.cnblogs.com/fanqisoft/p/10283790.html
Copyright © 2011-2022 走看看