Require RSocket 1.0+
This commit removes usage of methods and classes that were previously deprecated in RSocket and Spring Framework and have been removed. Closes gh-22764
This commit is contained in:
@@ -155,9 +155,8 @@ public class IntegrationAutoConfiguration {
|
||||
/**
|
||||
* Integration RSocket configuration.
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@ConditionalOnClass({ IntegrationRSocketEndpoint.class, RSocketRequester.class, io.rsocket.RSocketFactory.class })
|
||||
@ConditionalOnClass({ IntegrationRSocketEndpoint.class, RSocketRequester.class, io.rsocket.RSocket.class })
|
||||
@Conditional(IntegrationRSocketConfiguration.AnyRSocketChannelAdapterAvailable.class)
|
||||
protected static class IntegrationRSocketConfiguration {
|
||||
|
||||
|
||||
@@ -36,9 +36,8 @@ import org.springframework.messaging.rsocket.annotation.support.RSocketMessageHa
|
||||
* @author Brian Clozel
|
||||
* @since 2.2.0
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@ConditionalOnClass({ RSocketRequester.class, io.rsocket.RSocketFactory.class, TcpServerTransport.class })
|
||||
@ConditionalOnClass({ RSocketRequester.class, io.rsocket.RSocket.class, TcpServerTransport.class })
|
||||
@AutoConfigureAfter(RSocketStrategiesAutoConfiguration.class)
|
||||
public class RSocketMessagingAutoConfiguration {
|
||||
|
||||
|
||||
@@ -39,10 +39,8 @@ import org.springframework.messaging.rsocket.RSocketStrategies;
|
||||
* @author Brian Clozel
|
||||
* @since 2.2.0
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@ConditionalOnClass({ RSocketRequester.class, io.rsocket.RSocketFactory.class, HttpServer.class,
|
||||
TcpServerTransport.class })
|
||||
@ConditionalOnClass({ RSocketRequester.class, io.rsocket.RSocket.class, HttpServer.class, TcpServerTransport.class })
|
||||
@AutoConfigureAfter(RSocketStrategiesAutoConfiguration.class)
|
||||
public class RSocketRequesterAutoConfiguration {
|
||||
|
||||
|
||||
@@ -69,13 +69,10 @@ public class RSocketServerAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
@SuppressWarnings("deprecation")
|
||||
RSocketWebSocketNettyRouteProvider rSocketWebsocketRouteProvider(RSocketProperties properties,
|
||||
RSocketMessageHandler messageHandler,
|
||||
ObjectProvider<org.springframework.boot.rsocket.server.ServerRSocketFactoryProcessor> processors,
|
||||
ObjectProvider<RSocketServerCustomizer> customizers) {
|
||||
RSocketMessageHandler messageHandler, ObjectProvider<RSocketServerCustomizer> customizers) {
|
||||
return new RSocketWebSocketNettyRouteProvider(properties.getServer().getMappingPath(),
|
||||
messageHandler.responder(), processors.orderedStream(), customizers.orderedStream());
|
||||
messageHandler.responder(), customizers.orderedStream());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -92,9 +89,7 @@ public class RSocketServerAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
@SuppressWarnings("deprecation")
|
||||
RSocketServerFactory rSocketServerFactory(RSocketProperties properties, ReactorResourceFactory resourceFactory,
|
||||
ObjectProvider<org.springframework.boot.rsocket.server.ServerRSocketFactoryProcessor> processors,
|
||||
ObjectProvider<RSocketServerCustomizer> customizers) {
|
||||
NettyRSocketServerFactory factory = new NettyRSocketServerFactory();
|
||||
factory.setResourceFactory(resourceFactory);
|
||||
@@ -103,7 +98,6 @@ public class RSocketServerAutoConfiguration {
|
||||
map.from(properties.getServer().getAddress()).to(factory::setAddress);
|
||||
map.from(properties.getServer().getPort()).to(factory::setPort);
|
||||
factory.setRSocketServerCustomizers(customizers.orderedStream().collect(Collectors.toList()));
|
||||
factory.setSocketFactoryProcessors(processors.orderedStream().collect(Collectors.toList()));
|
||||
return factory;
|
||||
}
|
||||
|
||||
|
||||
@@ -47,9 +47,8 @@ import org.springframework.web.util.pattern.PathPatternRouteMatcher;
|
||||
* @author Brian Clozel
|
||||
* @since 2.2.0
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@ConditionalOnClass({ io.rsocket.RSocketFactory.class, RSocketStrategies.class, PooledByteBufAllocator.class })
|
||||
@ConditionalOnClass({ io.rsocket.RSocket.class, RSocketStrategies.class, PooledByteBufAllocator.class })
|
||||
@AutoConfigureAfter(JacksonAutoConfiguration.class)
|
||||
public class RSocketStrategiesAutoConfiguration {
|
||||
|
||||
|
||||
@@ -34,32 +34,24 @@ import org.springframework.boot.web.embedded.netty.NettyRouteProvider;
|
||||
*
|
||||
* @author Brian Clozel
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
class RSocketWebSocketNettyRouteProvider implements NettyRouteProvider {
|
||||
|
||||
private final String mappingPath;
|
||||
|
||||
private final SocketAcceptor socketAcceptor;
|
||||
|
||||
private final List<org.springframework.boot.rsocket.server.ServerRSocketFactoryProcessor> processors;
|
||||
|
||||
private final List<RSocketServerCustomizer> customizers;
|
||||
|
||||
RSocketWebSocketNettyRouteProvider(String mappingPath, SocketAcceptor socketAcceptor,
|
||||
Stream<org.springframework.boot.rsocket.server.ServerRSocketFactoryProcessor> processors,
|
||||
Stream<RSocketServerCustomizer> customizers) {
|
||||
this.mappingPath = mappingPath;
|
||||
this.socketAcceptor = socketAcceptor;
|
||||
this.processors = processors.collect(Collectors.toList());
|
||||
this.customizers = customizers.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpServerRoutes apply(HttpServerRoutes httpServerRoutes) {
|
||||
RSocketServer server = RSocketServer.create(this.socketAcceptor);
|
||||
io.rsocket.RSocketFactory.ServerRSocketFactory factory = new io.rsocket.RSocketFactory.ServerRSocketFactory(
|
||||
server);
|
||||
this.processors.forEach((processor) -> processor.process(factory));
|
||||
this.customizers.forEach((customizer) -> customizer.customize(server));
|
||||
ServerTransport.ConnectionAcceptor connectionAcceptor = server.asConnectionAcceptor();
|
||||
return httpServerRoutes.ws(this.mappingPath, WebsocketRouteTransport.newHandler(connectionAcceptor));
|
||||
|
||||
@@ -75,7 +75,6 @@ class RSocketWebSocketNettyRouteProviderTests {
|
||||
WebTestClient client = createWebTestClient(serverContext.getWebServer());
|
||||
client.get().uri("/protocol").exchange().expectStatus().isOk().expectBody().jsonPath("name",
|
||||
"http");
|
||||
assertThat(WebConfiguration.processorCallCount).isEqualTo(1);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -93,8 +92,6 @@ class RSocketWebSocketNettyRouteProviderTests {
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
static class WebConfiguration {
|
||||
|
||||
static int processorCallCount = 0;
|
||||
|
||||
@Bean
|
||||
WebController webController() {
|
||||
return new WebController();
|
||||
@@ -107,15 +104,6 @@ class RSocketWebSocketNettyRouteProviderTests {
|
||||
return serverFactory;
|
||||
}
|
||||
|
||||
@Bean
|
||||
@SuppressWarnings("deprecation")
|
||||
org.springframework.boot.rsocket.server.ServerRSocketFactoryProcessor myRSocketFactoryProcessor() {
|
||||
return (server) -> {
|
||||
processorCallCount++;
|
||||
return server;
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Controller
|
||||
|
||||
Reference in New Issue
Block a user