INT-4066: Expose RMI Factory Bean
JIRA: https://jira.spring.io/browse/INT-4066 Allow customization. Rename To RmiProxyFactoryBeanConfigurer Polishing More Polishing Polishing * Backport polishing
This commit is contained in:
committed by
Artem Bilan
parent
934b22cc79
commit
e18be4def6
@@ -75,3 +75,42 @@ The following code snippet shows the different configuration for an outbound rmi
|
||||
remote-channel="testChannel"
|
||||
host="localhost"/>
|
||||
----
|
||||
|
||||
=== Configuring with Java Configuration
|
||||
|
||||
[source, java]
|
||||
----
|
||||
@Bean
|
||||
public RmiInboundGateway inbound() {
|
||||
RmiInboundGateway gateway = new RmiInboundGateway();
|
||||
gateway.setRequestChannel(requestChannel());
|
||||
gateway.setRegistryHost("host");
|
||||
gateway.setRegistryPort(port);
|
||||
return gateway;
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ServiceActivator(inputChannel="inChannel")
|
||||
public RmiOutboundGateway outbound() {
|
||||
RmiOutboundGateway gateway = new RmiOutboundGateway("rmi://host:port/"
|
||||
+ RmiInboundGateway.SERVICE_NAME_PREFIX + "remoteChannelName");
|
||||
return gateway;
|
||||
}
|
||||
----
|
||||
|
||||
Starting with _version 4.3_, the outbound gateway has a second constructor that takes a RmiProxyFactoryBeanConfigurer instance along with the service url argument.
|
||||
This allows further configuration before the proxy is created; for example, to inject a Spring Security `ContextPropagatingRemoteInvocationFactory`:
|
||||
|
||||
[source, java]
|
||||
----
|
||||
@Bean
|
||||
@ServiceActivator(inputChannel="inChannel")
|
||||
public RmiOutboundGateway outbound() {
|
||||
RmiOutboundGateway gateway = new RmiOutboundGateway("rmi://host:port/"
|
||||
+ RmiInboundGateway.SERVICE_NAME_PREFIX + "remoteChannelName",
|
||||
pfb -> {
|
||||
pfb.setRemoteInvocationFactory(new ContextPropagatingRemoteInvocationFactory());
|
||||
});
|
||||
return gateway;
|
||||
}
|
||||
----
|
||||
|
||||
Reference in New Issue
Block a user