From a5b178657fba103c8e5a79b5e59445f7872e62f5 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Fri, 8 Jul 2022 18:23:36 +0100 Subject: [PATCH] Revert "Start building against Reactor 2022.0.0-M4 snapshots" This reverts commit 47993c094bbb1ba787e7c6d2561a228976af84c7. Couchbase and Spring Data Couchbase are not compatibile with the latest Reactor snapshots as they use deprecated API that has now been removed. See gh-31609 --- .../redis/LettuceConnectionConfiguration.java | 17 +---------------- .../autoconfigure/web/ServerProperties.java | 4 ---- .../NettyWebServerFactoryCustomizer.java | 11 ++--------- .../web/ServerPropertiesTests.java | 1 - .../NettyWebServerFactoryCustomizerTests.java | 14 ++------------ .../spring-boot-dependencies/build.gradle | 2 +- 6 files changed, 6 insertions(+), 43 deletions(-) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/redis/LettuceConnectionConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/redis/LettuceConnectionConfiguration.java index 2c204608f8..9d7f20cb3d 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/redis/LettuceConnectionConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/redis/LettuceConnectionConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2022 the original author or authors. + * Copyright 2012-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,12 +25,9 @@ import io.lettuce.core.TimeoutOptions; import io.lettuce.core.cluster.ClusterClientOptions; import io.lettuce.core.cluster.ClusterTopologyRefreshOptions; import io.lettuce.core.cluster.ClusterTopologyRefreshOptions.Builder; -import io.lettuce.core.event.Event; -import io.lettuce.core.event.EventBus; import io.lettuce.core.resource.ClientResources; import io.lettuce.core.resource.DefaultClientResources; import org.apache.commons.pool2.impl.GenericObjectPoolConfig; -import reactor.core.publisher.Flux; import org.springframework.beans.factory.ObjectProvider; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; @@ -72,18 +69,6 @@ class LettuceConnectionConfiguration extends RedisConnectionConfiguration { @ConditionalOnMissingBean(ClientResources.class) DefaultClientResources lettuceClientResources(ObjectProvider customizers) { DefaultClientResources.Builder builder = DefaultClientResources.builder(); - builder.eventBus(new EventBus() { - - @Override - public Flux get() { - return Flux.empty(); - } - - @Override - public void publish(Event event) { - } - - }); customizers.orderedStream().forEach((customizer) -> customizer.customize(builder)); return builder.build(); } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerProperties.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerProperties.java index 2a0333d0bb..570464db5b 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerProperties.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerProperties.java @@ -31,7 +31,6 @@ import java.util.Map; import io.undertow.UndertowOptions; import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.boot.context.properties.DeprecatedConfigurationProperty; import org.springframework.boot.context.properties.NestedConfigurationProperty; import org.springframework.boot.convert.DurationUnit; import org.springframework.boot.web.server.Compression; @@ -1385,13 +1384,10 @@ public class ServerProperties { this.initialBufferSize = initialBufferSize; } - @Deprecated - @DeprecatedConfigurationProperty(reason = "Deprecated for removal in Reactor Netty") public DataSize getMaxChunkSize() { return this.maxChunkSize; } - @Deprecated public void setMaxChunkSize(DataSize maxChunkSize) { this.maxChunkSize = maxChunkSize; } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/embedded/NettyWebServerFactoryCustomizer.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/embedded/NettyWebServerFactoryCustomizer.java index 382ef4bf2b..1776b8c97b 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/embedded/NettyWebServerFactoryCustomizer.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/embedded/NettyWebServerFactoryCustomizer.java @@ -19,7 +19,6 @@ package org.springframework.boot.autoconfigure.web.embedded; import java.time.Duration; import io.netty.channel.ChannelOption; -import reactor.netty.http.server.HttpRequestDecoderSpec; import org.springframework.boot.autoconfigure.web.ServerProperties; import org.springframework.boot.cloud.CloudPlatform; @@ -87,7 +86,8 @@ public class NettyWebServerFactoryCustomizer .to((maxHttpRequestHeader) -> httpRequestDecoderSpec .maxHeaderSize((int) maxHttpRequestHeader.toBytes())); ServerProperties.Netty nettyProperties = this.serverProperties.getNetty(); - maxChunkSize(propertyMapper, httpRequestDecoderSpec, nettyProperties); + propertyMapper.from(nettyProperties.getMaxChunkSize()).whenNonNull() + .to((maxChunkSize) -> httpRequestDecoderSpec.maxChunkSize((int) maxChunkSize.toBytes())); propertyMapper.from(nettyProperties.getMaxInitialLineLength()).whenNonNull() .to((maxInitialLineLength) -> httpRequestDecoderSpec .maxInitialLineLength((int) maxInitialLineLength.toBytes())); @@ -102,13 +102,6 @@ public class NettyWebServerFactoryCustomizer })); } - @SuppressWarnings("deprecation") - private void maxChunkSize(PropertyMapper propertyMapper, HttpRequestDecoderSpec httpRequestDecoderSpec, - ServerProperties.Netty nettyProperties) { - propertyMapper.from(nettyProperties.getMaxChunkSize()).whenNonNull() - .to((maxChunkSize) -> httpRequestDecoderSpec.maxChunkSize((int) maxChunkSize.toBytes())); - } - private void customizeIdleTimeout(NettyReactiveWebServerFactory factory, Duration idleTimeout) { factory.addServerCustomizers((httpServer) -> httpServer.idleTimeout(idleTimeout)); } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java index 3e12fd0758..887869f542 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java @@ -514,7 +514,6 @@ class ServerPropertiesTests { } @Test - @SuppressWarnings("deprecation") void nettyMaxChunkSizeMatchesHttpDecoderSpecDefault() { assertThat(this.properties.getNetty().getMaxChunkSize().toBytes()) .isEqualTo(HttpDecoderSpec.DEFAULT_MAX_CHUNK_SIZE); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/embedded/NettyWebServerFactoryCustomizerTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/embedded/NettyWebServerFactoryCustomizerTests.java index 696dc5bf10..dbb9785edc 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/embedded/NettyWebServerFactoryCustomizerTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/embedded/NettyWebServerFactoryCustomizerTests.java @@ -132,7 +132,7 @@ class NettyWebServerFactoryCustomizerTests { nettyProperties.setValidateHeaders(false); nettyProperties.setInitialBufferSize(DataSize.ofBytes(512)); nettyProperties.setH2cMaxContentLength(DataSize.ofKilobytes(1)); - setMaxChunkSize(nettyProperties); + nettyProperties.setMaxChunkSize(DataSize.ofKilobytes(16)); nettyProperties.setMaxInitialLineLength(DataSize.ofKilobytes(32)); NettyReactiveWebServerFactory factory = mock(NettyReactiveWebServerFactory.class); this.customizer.customize(factory); @@ -143,18 +143,8 @@ class NettyWebServerFactoryCustomizerTests { assertThat(decoder.validateHeaders()).isFalse(); assertThat(decoder.initialBufferSize()).isEqualTo(nettyProperties.getInitialBufferSize().toBytes()); assertThat(decoder.h2cMaxContentLength()).isEqualTo(nettyProperties.getH2cMaxContentLength().toBytes()); - assertMaxChunkSize(nettyProperties, decoder); - assertThat(decoder.maxInitialLineLength()).isEqualTo(nettyProperties.getMaxInitialLineLength().toBytes()); - } - - @SuppressWarnings("deprecation") - private void setMaxChunkSize(ServerProperties.Netty nettyProperties) { - nettyProperties.setMaxChunkSize(DataSize.ofKilobytes(16)); - } - - @SuppressWarnings("deprecation") - private void assertMaxChunkSize(ServerProperties.Netty nettyProperties, HttpRequestDecoderSpec decoder) { assertThat(decoder.maxChunkSize()).isEqualTo(nettyProperties.getMaxChunkSize().toBytes()); + assertThat(decoder.maxInitialLineLength()).isEqualTo(nettyProperties.getMaxInitialLineLength().toBytes()); } private void verifyConnectionTimeout(NettyReactiveWebServerFactory factory, Integer expected) { diff --git a/spring-boot-project/spring-boot-dependencies/build.gradle b/spring-boot-project/spring-boot-dependencies/build.gradle index f323066cb2..d9c5315fcc 100644 --- a/spring-boot-project/spring-boot-dependencies/build.gradle +++ b/spring-boot-project/spring-boot-dependencies/build.gradle @@ -1188,7 +1188,7 @@ bom { ] } } - library("Reactor Bom", "2022.0.0-SNAPSHOT") { + library("Reactor Bom", "2022.0.0-M2") { group("io.projectreactor") { imports = [ "reactor-bom"