Apply RSocket transport configuration on server

Fixes gh-17845
pull/17847/head
Brian Clozel 5 years ago
parent 2059147421
commit 16f798dc11

@ -19,6 +19,7 @@ package org.springframework.boot.autoconfigure.rsocket;
import java.net.InetAddress;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.rsocket.server.RSocketServer;
/**
* {@link ConfigurationProperties properties} for RSocket support.
@ -50,7 +51,7 @@ public class RSocketProperties {
/**
* RSocket transport protocol.
*/
private Transport transport = Transport.TCP;
private RSocketServer.TRANSPORT transport = RSocketServer.TRANSPORT.TCP;
/**
* Path under which RSocket handles requests (only works with websocket
@ -74,11 +75,11 @@ public class RSocketProperties {
this.address = address;
}
public Transport getTransport() {
public RSocketServer.TRANSPORT getTransport() {
return this.transport;
}
public void setTransport(Transport transport) {
public void setTransport(RSocketServer.TRANSPORT transport) {
this.transport = transport;
}
@ -90,12 +91,6 @@ public class RSocketProperties {
this.mappingPath = mappingPath;
}
public enum Transport {
TCP, WEBSOCKET
}
}
}

@ -92,6 +92,7 @@ public class RSocketServerAutoConfiguration {
ObjectProvider<ServerRSocketFactoryCustomizer> customizers) {
NettyRSocketServerFactory factory = new NettyRSocketServerFactory();
factory.setResourceFactory(resourceFactory);
factory.setTransport(properties.getServer().getTransport());
PropertyMapper map = PropertyMapper.get().alwaysApplyingWhenNonNull();
map.from(properties.getServer().getAddress()).to(factory::setAddress);
map.from(properties.getServer().getPort()).to(factory::setPort);

Loading…
Cancel
Save