httpinvokerserviceexporter在春季5中被弃用。是否有任何替代品?它会在春季6春天提供吗?

发布于 2025-02-13 21:20:04 字数 1681 浏览 2 评论 0原文

httpinvokerserviceexporter在春季5中弃用。我想通过HTTP协议致电Spring Remote Bean。有替代品吗? httpinvokerserviceexporter也有RCE的脆弱性,因此我需要使用httpinvokerserviceexporter的一些替换。

RMI骨架

@Configuration
public class RMIServer {

    @Bean
    DTBookingService bookingService() {
    return new DTBookingServiceImpl();
    }

    @Bean(name = "exporter")
    RmiServiceExporter exporter(DTBookingService implementation) {
        Class<DTBookingService> serviceInterface = DTBookingService.class;
        RmiServiceExporter exporter = new RmiServiceExporter();
        exporter.setServiceInterface(serviceInterface); //interface
        exporter.setService(implementation); //bean
        exporter.setServiceName("bookingService"); //bean name
        exporter.setRegistryPort(1099);
        try {
            exporter.prepare();
        } catch (RemoteException e) {
            e.printStackTrace();
        }        
        return exporter;
    }
}

RMI存根致电远程豆 导入javax.naming.context;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.remoting.rmi.RmiProxyFactoryBean;

@Configuration
public class RMIClientConfig {

    @Bean
    RmiProxyFactoryBean service() {
        RmiProxyFactoryBean proxyFactoryBean = new RmiProxyFactoryBean();
        proxyFactoryBean.setServiceUrl("rmi://localhost:1099/bookingService");
        proxyFactoryBean.setServiceInterface(DTBookingService.class);
        return proxyFactoryBean;
    }
}

现在,我试图通过httpinvokerserviceexporter通过http协议而不是rmi://(rmiserviceexporter)调用bean。请建议是否替换HTTPINVOKERSERVICEEXPORTER。

HttpInvokerServiceExporter is deprecated in spring 5. I want to call spring remote bean via HTTP protocol. Is there any replacement? HttpInvokerServiceExporter has a vulnerability of RCE also so i need to use some replacement of HttpInvokerServiceExporter.

RMI skeleton

@Configuration
public class RMIServer {

    @Bean
    DTBookingService bookingService() {
    return new DTBookingServiceImpl();
    }

    @Bean(name = "exporter")
    RmiServiceExporter exporter(DTBookingService implementation) {
        Class<DTBookingService> serviceInterface = DTBookingService.class;
        RmiServiceExporter exporter = new RmiServiceExporter();
        exporter.setServiceInterface(serviceInterface); //interface
        exporter.setService(implementation); //bean
        exporter.setServiceName("bookingService"); //bean name
        exporter.setRegistryPort(1099);
        try {
            exporter.prepare();
        } catch (RemoteException e) {
            e.printStackTrace();
        }        
        return exporter;
    }
}

RMI Stub to call remote bean
import javax.naming.Context;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.remoting.rmi.RmiProxyFactoryBean;

@Configuration
public class RMIClientConfig {

    @Bean
    RmiProxyFactoryBean service() {
        RmiProxyFactoryBean proxyFactoryBean = new RmiProxyFactoryBean();
        proxyFactoryBean.setServiceUrl("rmi://localhost:1099/bookingService");
        proxyFactoryBean.setServiceInterface(DTBookingService.class);
        return proxyFactoryBean;
    }
}

Now i am trying to call bean via HttpInvokerServiceExporter via http protocol instead of rmi://(RmiServiceExporter). Please suggest if any replacement of HttpInvokerServiceExporter.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

香草可樂 2025-02-20 21:20:05

根据

https:// https://docs.spring.io/spring.io/spring.io/spring -framework/docs/6.0.7/javadoc-api/

整个软件包分支机构org.springframework.Remoting spring 6不可用。

我想他们由于安全问题而丢弃了RMI支持。

According to

https://docs.spring.io/spring-framework/docs/6.0.7/javadoc-api/

the whole package branch org.springframework.remoting is not available for Spring 6.

I suppose they dropped the RMI support because of security issues.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文