httpinvokerserviceexporter在春季5中被弃用。是否有任何替代品?它会在春季6春天提供吗?
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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据
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.