From 9eb72606997867da86b60a78739f89110ebb82d3 Mon Sep 17 00:00:00 2001 From: Brian Clozel Date: Thu, 11 Apr 2019 20:52:49 +0200 Subject: [PATCH] Polish RSocket server support Relax the `NettyRSocketBootstrap` contract to allow all types of `SocketAcceptor` implementations. See gh-16021 --- .../rsocket/RSocketServerAutoConfiguration.java | 6 +++--- .../boot/rsocket/netty/NettyRSocketBootstrap.java | 7 ++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/rsocket/RSocketServerAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/rsocket/RSocketServerAutoConfiguration.java index d493e6e64c5..d4c59eb6684 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/rsocket/RSocketServerAutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/rsocket/RSocketServerAutoConfiguration.java @@ -20,6 +20,7 @@ import java.util.stream.Collectors; import io.netty.buffer.PooledByteBufAllocator; import io.rsocket.RSocketFactory; +import io.rsocket.SocketAcceptor; import org.springframework.beans.factory.ObjectProvider; import org.springframework.boot.autoconfigure.AutoConfigureAfter; @@ -106,9 +107,8 @@ public class RSocketServerAutoConfiguration { @Bean public NettyRSocketBootstrap nettyRSocketBootstrap( RSocketServerFactory rSocketServerFactory, - MessageHandlerAcceptor messageHandlerAcceptor) { - return new NettyRSocketBootstrap(rSocketServerFactory, - messageHandlerAcceptor); + SocketAcceptor socketAcceptor) { + return new NettyRSocketBootstrap(rSocketServerFactory, socketAcceptor); } } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/rsocket/netty/NettyRSocketBootstrap.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/rsocket/netty/NettyRSocketBootstrap.java index 0c97dcb9c48..85e76011de1 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/rsocket/netty/NettyRSocketBootstrap.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/rsocket/netty/NettyRSocketBootstrap.java @@ -16,13 +16,14 @@ package org.springframework.boot.rsocket.netty; +import io.rsocket.SocketAcceptor; + import org.springframework.boot.rsocket.context.RSocketServerInitializedEvent; import org.springframework.boot.rsocket.server.RSocketServer; import org.springframework.boot.rsocket.server.RSocketServerFactory; import org.springframework.context.ApplicationEventPublisher; import org.springframework.context.ApplicationEventPublisherAware; import org.springframework.context.SmartLifecycle; -import org.springframework.messaging.rsocket.MessageHandlerAcceptor; /** * Bootstrap an {@link RSocketServer} and start it with the application context. @@ -38,8 +39,8 @@ public class NettyRSocketBootstrap private ApplicationEventPublisher applicationEventPublisher; public NettyRSocketBootstrap(RSocketServerFactory serverFactoryProvider, - MessageHandlerAcceptor messageHandlerAcceptorProvider) { - this.rSocketServer = serverFactoryProvider.create(messageHandlerAcceptorProvider); + SocketAcceptor socketAcceptor) { + this.rSocketServer = serverFactoryProvider.create(socketAcceptor); } @Override