HttpInvokerServiceExporter is deprecated in spring 5. Is there any replacement? Will it be available in spring 6?

1.2k Views Asked by At

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.

1

There are 1 best solutions below

0
30thh On

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.