diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle index 2968c3e14e..a0fa56fff9 100644 --- a/buildSrc/build.gradle +++ b/buildSrc/build.gradle @@ -14,15 +14,10 @@ new File(new File("$projectDir").parentFile, "gradle.properties").withInputStrea def properties = new Properties() properties.load(it) ext.set("kotlinVersion", properties["kotlinVersion"]) - ext.set("springFrameworkVersion", properties["springFrameworkVersion"]) - if (properties["springFrameworkVersion"].contains("-")) { - repositories { - maven { url "https://repo.spring.io/milestone" } - maven { url "https://repo.spring.io/snapshot" } - } - } } +ext.set("springFrameworkVersion", "6.0.10") + sourceCompatibility = 17 targetCompatibility = 17 diff --git a/gradle.properties b/gradle.properties index 15ed1df1cc..eb9bbe14af 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,7 +6,7 @@ org.gradle.jvmargs=-Xmx2g -Dfile.encoding=UTF-8 kotlinVersion=1.8.22 nativeBuildToolsVersion=0.9.23 -springFrameworkVersion=6.0.10 +springFrameworkVersion=6.1.0-M1 tomcatVersion=10.1.10 kotlin.stdlib.default.dependency=false diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/observation/web/reactive/OrderedServerHttpObservationFilter.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/observation/web/reactive/OrderedServerHttpObservationFilter.java index 9d3146f1db..4541f6e165 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/observation/web/reactive/OrderedServerHttpObservationFilter.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/observation/web/reactive/OrderedServerHttpObservationFilter.java @@ -28,6 +28,7 @@ import org.springframework.web.filter.reactive.ServerHttpObservationFilter; * * @author Moritz Halbritter */ +@SuppressWarnings({ "deprecation", "removal" }) class OrderedServerHttpObservationFilter extends ServerHttpObservationFilter implements OrderedWebFilter { private final int order; diff --git a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/web/client/TestRestTemplate.java b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/web/client/TestRestTemplate.java index dca0856b70..24e38b8ab5 100644 --- a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/web/client/TestRestTemplate.java +++ b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/web/client/TestRestTemplate.java @@ -1021,9 +1021,6 @@ public class TestRestTemplate { if (settings.connectTimeout() != null) { setConnectTimeout((int) settings.connectTimeout().toMillis()); } - if (settings.bufferRequestBody() != null) { - setBufferRequestBody(settings.bufferRequestBody()); - } } private HttpClient createHttpClient(Duration readTimeout, boolean ssl) { diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootContextLoaderTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootContextLoaderTests.java index 6715719eab..5102e242d5 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootContextLoaderTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootContextLoaderTests.java @@ -255,7 +255,7 @@ class SpringBootContextLoaderTests { private Map getMergedContextConfigurationProperties(Class testClass) { TestContext context = new ExposedTestContextManager(testClass).getExposedTestContext(); MergedContextConfiguration config = (MergedContextConfiguration) ReflectionTestUtils.getField(context, - "mergedContextConfiguration"); + "mergedConfig"); return TestPropertySourceUtils.convertInlinedPropertiesToMap(config.getPropertySourceProperties()); } diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/bootstrap/SpringBootTestContextBootstrapperTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/bootstrap/SpringBootTestContextBootstrapperTests.java index db724a374a..c38c81fc81 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/bootstrap/SpringBootTestContextBootstrapperTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/bootstrap/SpringBootTestContextBootstrapperTests.java @@ -110,7 +110,7 @@ class SpringBootTestContextBootstrapperTests { } private MergedContextConfiguration getMergedContextConfiguration(TestContext context) { - return (MergedContextConfiguration) ReflectionTestUtils.getField(context, "mergedContextConfiguration"); + return (MergedContextConfiguration) ReflectionTestUtils.getField(context, "mergedConfig"); } @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) diff --git a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/build.gradle b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/build.gradle index d890be6a2a..8f5db820df 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/build.gradle +++ b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/build.gradle @@ -14,6 +14,11 @@ configurations.all { if (dependency.requested.group.startsWith("com.fasterxml.jackson")) { dependency.useVersion("2.14.2") } + // Downgrade Spring Framework as Gradle cannot cope with 6.1.0-M1's + // multi-version jar files with bytecode in META-INF/versions/21 + if (dependency.requested.group.equals("org.springframework")) { + dependency.useVersion("6.0.10") + } } } } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/build.gradle b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/build.gradle index 80b5f7e940..7939ef31bb 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/build.gradle +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/build.gradle @@ -23,6 +23,11 @@ configurations { if (dependency.requested.group.startsWith("com.fasterxml.jackson")) { dependency.useVersion("2.14.2") } + // Downgrade Spring Framework as Gradle cannot cope with 6.1.0-M1's + // multi-version jar files with bytecode in META-INF/versions/21 + if (dependency.requested.group.equals("org.springframework")) { + dependency.useVersion("6.0.10") + } } } } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/build.gradle b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/build.gradle index c6b1873170..755f1cc7bc 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/build.gradle +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/build.gradle @@ -17,6 +17,17 @@ configurations { extendsFrom dependencyManagement transitive = false } + all { + resolutionStrategy { + eachDependency { dependency -> + // Downgrade Spring Framework as Gradle cannot cope with 6.1.0-M1's + // multi-version jar files with bytecode in META-INF/versions/21 + if (dependency.requested.group.equals("org.springframework")) { + dependency.useVersion("6.0.10") + } + } + } + } } dependencies { diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/ClientHttpRequestFactories.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/ClientHttpRequestFactories.java index 4f6de573f6..61b3e93610 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/ClientHttpRequestFactories.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/ClientHttpRequestFactories.java @@ -151,7 +151,6 @@ public final class ClientHttpRequestFactories { settings.sslBundle()); PropertyMapper map = PropertyMapper.get().alwaysApplyingWhenNonNull(); map.from(settings::connectTimeout).asInt(Duration::toMillis).to(requestFactory::setConnectTimeout); - map.from(settings::bufferRequestBody).to(requestFactory::setBufferRequestBody); return requestFactory; } @@ -187,8 +186,6 @@ public final class ClientHttpRequestFactories { static class OkHttp { static OkHttp3ClientHttpRequestFactory get(ClientHttpRequestFactorySettings settings) { - Assert.state(settings.bufferRequestBody() == null, - () -> "OkHttp3ClientHttpRequestFactory does not support request body buffering"); OkHttp3ClientHttpRequestFactory requestFactory = createRequestFactory(settings.sslBundle()); PropertyMapper map = PropertyMapper.get().alwaysApplyingWhenNonNull(); map.from(settings::connectTimeout).asInt(Duration::toMillis).to(requestFactory::setConnectTimeout); @@ -227,7 +224,6 @@ public final class ClientHttpRequestFactories { PropertyMapper map = PropertyMapper.get().alwaysApplyingWhenNonNull(); map.from(settings::readTimeout).asInt(Duration::toMillis).to(requestFactory::setReadTimeout); map.from(settings::connectTimeout).asInt(Duration::toMillis).to(requestFactory::setConnectTimeout); - map.from(settings::bufferRequestBody).to(requestFactory::setBufferRequestBody); return requestFactory; } @@ -274,8 +270,6 @@ public final class ClientHttpRequestFactories { PropertyMapper map = PropertyMapper.get().alwaysApplyingWhenNonNull(); map.from(settings::connectTimeout).to((connectTimeout) -> setConnectTimeout(unwrapped, connectTimeout)); map.from(settings::readTimeout).to((readTimeout) -> setReadTimeout(unwrapped, readTimeout)); - map.from(settings::bufferRequestBody) - .to((bufferRequestBody) -> setBufferRequestBody(unwrapped, bufferRequestBody)); } private static ClientHttpRequestFactory unwrapRequestFactoryIfNecessary( @@ -305,11 +299,6 @@ public final class ClientHttpRequestFactories { invoke(factory, method, timeout); } - private static void setBufferRequestBody(ClientHttpRequestFactory factory, boolean bufferRequestBody) { - Method method = findMethod(factory, "setBufferRequestBody", boolean.class); - invoke(factory, method, bufferRequestBody); - } - private static Method findMethod(ClientHttpRequestFactory requestFactory, String methodName, Class... parameters) { Method method = ReflectionUtils.findMethod(requestFactory.getClass(), methodName, parameters); diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/ClientHttpRequestFactoriesRuntimeHints.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/ClientHttpRequestFactoriesRuntimeHints.java index c47ef109a6..457110d6c1 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/ClientHttpRequestFactoriesRuntimeHints.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/ClientHttpRequestFactoriesRuntimeHints.java @@ -69,7 +69,6 @@ class ClientHttpRequestFactoriesRuntimeHints implements RuntimeHintsRegistrar { Class requestFactoryType) { registerMethod(hints, requestFactoryType, "setConnectTimeout", int.class); registerMethod(hints, requestFactoryType, "setReadTimeout", int.class); - registerMethod(hints, requestFactoryType, "setBufferRequestBody", boolean.class); } private void registerMethod(ReflectionHints hints, Class requestFactoryType, diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/ClientHttpRequestFactorySettings.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/ClientHttpRequestFactorySettings.java index 22deb5a4a1..204acffb93 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/ClientHttpRequestFactorySettings.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/ClientHttpRequestFactorySettings.java @@ -26,7 +26,6 @@ import org.springframework.http.client.ClientHttpRequestFactory; * * @param connectTimeout the connect timeout * @param readTimeout the read timeout - * @param bufferRequestBody if request body buffering is used * @param sslBundle the SSL bundle providing SSL configuration * @author Andy Wilkinson * @author Phillip Webb @@ -34,8 +33,7 @@ import org.springframework.http.client.ClientHttpRequestFactory; * @since 3.0.0 * @see ClientHttpRequestFactories */ -public record ClientHttpRequestFactorySettings(Duration connectTimeout, Duration readTimeout, Boolean bufferRequestBody, - SslBundle sslBundle) { +public record ClientHttpRequestFactorySettings(Duration connectTimeout, Duration readTimeout, SslBundle sslBundle) { /** * Use defaults for the {@link ClientHttpRequestFactory} which can differ depending on @@ -48,15 +46,29 @@ public record ClientHttpRequestFactorySettings(Duration connectTimeout, Duration * Create a new {@link ClientHttpRequestFactorySettings} instance. * @param connectTimeout the connection timeout * @param readTimeout the read timeout - * @param bufferRequestBody the bugger request body - * @param sslBundle the ssl bundle - * @since 3.1.0 + * @param bufferRequestBody if request body buffering is used + * @deprecated since 3.2.0 for removal in 3.4.0 as support for buffering has been + * removed in Spring Framework 6.1 */ - public ClientHttpRequestFactorySettings { + @Deprecated(since = "3.2.0", forRemoval = true) + public ClientHttpRequestFactorySettings(Duration connectTimeout, Duration readTimeout, Boolean bufferRequestBody) { + this(connectTimeout, readTimeout, (SslBundle) null); } - public ClientHttpRequestFactorySettings(Duration connectTimeout, Duration readTimeout, Boolean bufferRequestBody) { - this(connectTimeout, readTimeout, bufferRequestBody, null); + /** + * Create a new {@link ClientHttpRequestFactorySettings} instance. + * @param connectTimeout the connection timeout + * @param readTimeout the read timeout + * @param bufferRequestBody if request body buffering is used + * @param sslBundle the ssl bundle + * @since 3.1.0 + * @deprecated since 3.2.0 for removal in 3.4.0 as support for buffering has been + * removed in Spring Framework 6.1 + */ + @Deprecated(since = "3.2.0", forRemoval = true) + public ClientHttpRequestFactorySettings(Duration connectTimeout, Duration readTimeout, Boolean bufferRequestBody, + SslBundle sslBundle) { + this(connectTimeout, readTimeout, sslBundle); } /** @@ -66,8 +78,7 @@ public record ClientHttpRequestFactorySettings(Duration connectTimeout, Duration * @return a new {@link ClientHttpRequestFactorySettings} instance */ public ClientHttpRequestFactorySettings withConnectTimeout(Duration connectTimeout) { - return new ClientHttpRequestFactorySettings(connectTimeout, this.readTimeout, this.bufferRequestBody, - this.sslBundle); + return new ClientHttpRequestFactorySettings(connectTimeout, this.readTimeout, this.sslBundle); } /** @@ -78,19 +89,19 @@ public record ClientHttpRequestFactorySettings(Duration connectTimeout, Duration */ public ClientHttpRequestFactorySettings withReadTimeout(Duration readTimeout) { - return new ClientHttpRequestFactorySettings(this.connectTimeout, readTimeout, this.bufferRequestBody, - this.sslBundle); + return new ClientHttpRequestFactorySettings(this.connectTimeout, readTimeout, this.sslBundle); } /** - * Return a new {@link ClientHttpRequestFactorySettings} instance with an updated - * buffer request body setting. + * Has no effect as support for buffering has been removed in Spring Framework 6.1. * @param bufferRequestBody the new buffer request body setting * @return a new {@link ClientHttpRequestFactorySettings} instance + * @deprecated since 3.2.0 for removal in 3.4.0 as support for buffering has been + * removed in Spring Framework 6.1 */ + @Deprecated(since = "3.2.0", forRemoval = true) public ClientHttpRequestFactorySettings withBufferRequestBody(Boolean bufferRequestBody) { - return new ClientHttpRequestFactorySettings(this.connectTimeout, this.readTimeout, bufferRequestBody, - this.sslBundle); + return this; } /** @@ -101,8 +112,18 @@ public record ClientHttpRequestFactorySettings(Duration connectTimeout, Duration * @since 3.1.0 */ public ClientHttpRequestFactorySettings withSslBundle(SslBundle sslBundle) { - return new ClientHttpRequestFactorySettings(this.connectTimeout, this.readTimeout, this.bufferRequestBody, - sslBundle); + return new ClientHttpRequestFactorySettings(this.connectTimeout, this.readTimeout, sslBundle); + } + + /** + * Returns whether request body buffering is used. + * @return whether request body buffering is used + * @deprecated since 3.2.0 for removal in 3.4.0 as support for buffering has been + * removed in Spring Framework 6.1 + */ + @Deprecated(since = "3.2.0", forRemoval = true) + public Boolean bufferRequestBody() { + return null; } } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/RestTemplateBuilder.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/RestTemplateBuilder.java index 9a981759cb..93e4e1b918 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/RestTemplateBuilder.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/RestTemplateBuilder.java @@ -440,19 +440,18 @@ public class RestTemplateBuilder { } /** - * Sets if the underlying {@link ClientHttpRequestFactory} should buffer the - * {@linkplain ClientHttpRequest#getBody() request body} internally. + * Has no effect as support for buffering has been removed in Spring Framework 6.1. * @param bufferRequestBody value of the bufferRequestBody parameter * @return a new builder instance. * @since 2.2.0 + * @deprecated since 3.2.0 for removal in 3.4.0 as support for buffering has been + * removed in Spring Framework 6.1 * @see SimpleClientHttpRequestFactory#setBufferRequestBody(boolean) * @see HttpComponentsClientHttpRequestFactory#setBufferRequestBody(boolean) */ + @Deprecated(since = "3.2.0", forRemoval = true) public RestTemplateBuilder setBufferRequestBody(boolean bufferRequestBody) { - return new RestTemplateBuilder(this.requestFactorySettings.withBufferRequestBody(bufferRequestBody), - this.detectRequestFactory, this.rootUri, this.messageConverters, this.interceptors, this.requestFactory, - this.uriTemplateHandler, this.errorHandler, this.basicAuthentication, this.defaultHeaders, - this.customizers, this.requestCustomizers); + return this; } /** diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/webservices/client/HttpWebServiceMessageSenderBuilder.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/webservices/client/HttpWebServiceMessageSenderBuilder.java index 8f5dbb3d7c..5d25c93e60 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/webservices/client/HttpWebServiceMessageSenderBuilder.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/webservices/client/HttpWebServiceMessageSenderBuilder.java @@ -113,7 +113,7 @@ public class HttpWebServiceMessageSenderBuilder { private ClientHttpRequestFactory getRequestFactory() { ClientHttpRequestFactorySettings settings = new ClientHttpRequestFactorySettings(this.connectTimeout, - this.readTimeout, null, this.sslBundle); + this.readTimeout, this.sslBundle); return (this.requestFactory != null) ? this.requestFactory.apply(settings) : ClientHttpRequestFactories.get(settings); } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/client/ClientHttpRequestFactoriesOkHttp3Tests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/client/ClientHttpRequestFactoriesOkHttp3Tests.java index 59e4c31444..b54e8050d2 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/client/ClientHttpRequestFactoriesOkHttp3Tests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/client/ClientHttpRequestFactoriesOkHttp3Tests.java @@ -27,7 +27,6 @@ import org.springframework.http.client.OkHttp3ClientHttpRequestFactory; import org.springframework.test.util.ReflectionTestUtils; import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatIllegalStateException; /** * Tests for {@link ClientHttpRequestFactories} when OkHttp 3 is the predominant HTTP @@ -50,12 +49,6 @@ class ClientHttpRequestFactoriesOkHttp3Tests .startsWith("okhttp-3."); } - @Test - void getFailsWhenBufferRequestBodyIsEnabled() { - assertThatIllegalStateException().isThrownBy(() -> ClientHttpRequestFactories - .get(ClientHttpRequestFactorySettings.DEFAULTS.withBufferRequestBody(true))); - } - @Override protected long connectTimeout(OkHttp3ClientHttpRequestFactory requestFactory) { return ((OkHttpClient) ReflectionTestUtils.getField(requestFactory, "client")).connectTimeoutMillis(); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/client/ClientHttpRequestFactoriesOkHttp4Tests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/client/ClientHttpRequestFactoriesOkHttp4Tests.java index 13158708f5..d1f533f731 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/client/ClientHttpRequestFactoriesOkHttp4Tests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/client/ClientHttpRequestFactoriesOkHttp4Tests.java @@ -26,7 +26,6 @@ import org.springframework.http.client.OkHttp3ClientHttpRequestFactory; import org.springframework.test.util.ReflectionTestUtils; import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatIllegalStateException; /** * Tests for {@link ClientHttpRequestFactories} when OkHttp 4 is the predominant HTTP @@ -48,12 +47,6 @@ class ClientHttpRequestFactoriesOkHttp4Tests .startsWith("okhttp-4."); } - @Test - void getFailsWhenBufferRequestBodyIsEnabled() { - assertThatIllegalStateException().isThrownBy(() -> ClientHttpRequestFactories - .get(ClientHttpRequestFactorySettings.DEFAULTS.withBufferRequestBody(true))); - } - @Override protected long connectTimeout(OkHttp3ClientHttpRequestFactory requestFactory) { return ((OkHttpClient) ReflectionTestUtils.getField(requestFactory, "client")).connectTimeoutMillis(); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/client/ClientHttpRequestFactoriesRuntimeHintsTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/client/ClientHttpRequestFactoriesRuntimeHintsTests.java index bb143d3297..bbfdafccf5 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/client/ClientHttpRequestFactoriesRuntimeHintsTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/client/ClientHttpRequestFactoriesRuntimeHintsTests.java @@ -59,12 +59,6 @@ class ClientHttpRequestFactoriesRuntimeHintsTests { assertThat(reflection .onMethod(method(HttpComponentsClientHttpRequestFactory.class, "setConnectTimeout", int.class))) .accepts(hints); - assertThat( - reflection.onMethod(method(HttpComponentsClientHttpRequestFactory.class, "setReadTimeout", int.class))) - .accepts(hints); - assertThat(reflection - .onMethod(method(HttpComponentsClientHttpRequestFactory.class, "setBufferRequestBody", boolean.class))) - .accepts(hints); } @Test @@ -88,9 +82,6 @@ class ClientHttpRequestFactoriesRuntimeHintsTests { .accepts(hints); assertThat(reflection.onMethod(method(SimpleClientHttpRequestFactory.class, "setReadTimeout", int.class))) .accepts(hints); - assertThat(reflection - .onMethod(method(SimpleClientHttpRequestFactory.class, "setBufferRequestBody", boolean.class))) - .accepts(hints); } private static Method method(Class target, String name, Class... parameterTypes) { diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/client/ClientHttpRequestFactoriesTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/client/ClientHttpRequestFactoriesTests.java index 34d591efb3..546b862d98 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/client/ClientHttpRequestFactoriesTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/client/ClientHttpRequestFactoriesTests.java @@ -100,14 +100,6 @@ class ClientHttpRequestFactoriesTests { .isEqualTo(Duration.ofSeconds(90).toMillis()); } - @Test - void getOfUnknownTypeWithBodyBufferingCreatesFactoryAndConfiguresBodyBuffering() { - ClientHttpRequestFactory requestFactory = ClientHttpRequestFactories.get(TestClientHttpRequestFactory.class, - ClientHttpRequestFactorySettings.DEFAULTS.withBufferRequestBody(true)); - assertThat(requestFactory).isInstanceOf(TestClientHttpRequestFactory.class); - assertThat(((TestClientHttpRequestFactory) requestFactory).bufferRequestBody).isTrue(); - } - @Test void getOfUnconfigurableTypeWithConnectTimeoutThrows() { assertThatIllegalStateException() @@ -124,14 +116,6 @@ class ClientHttpRequestFactoriesTests { .withMessageContaining("suitable setReadTimeout method"); } - @Test - void getOfUnconfigurableTypeWithBodyBufferingThrows() { - assertThatIllegalStateException() - .isThrownBy(() -> ClientHttpRequestFactories.get(UnconfigurableClientHttpRequestFactory.class, - ClientHttpRequestFactorySettings.DEFAULTS.withBufferRequestBody(true))) - .withMessageContaining("suitable setBufferRequestBody method"); - } - @Test void getOfTypeWithDeprecatedConnectTimeoutThrowsWithConnectTimeout() { assertThatIllegalStateException() @@ -148,14 +132,6 @@ class ClientHttpRequestFactoriesTests { .withMessageContaining("setReadTimeout method marked as deprecated"); } - @Test - void getOfTypeWithDeprecatedBufferRequestBodyThrowsWithBufferRequestBody() { - assertThatIllegalStateException() - .isThrownBy(() -> ClientHttpRequestFactories.get(DeprecatedMethodsClientHttpRequestFactory.class, - ClientHttpRequestFactorySettings.DEFAULTS.withBufferRequestBody(false))) - .withMessageContaining("setBufferRequestBody method marked as deprecated"); - } - @Test void connectTimeoutCanBeConfiguredOnAWrappedRequestFactory() { SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory(); @@ -176,25 +152,12 @@ class ClientHttpRequestFactoriesTests { assertThat(requestFactory).hasFieldOrPropertyWithValue("readTimeout", 1234); } - @Test - void bufferRequestBodyCanBeConfiguredOnAWrappedRequestFactory() { - SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory(); - assertThat(requestFactory).hasFieldOrPropertyWithValue("bufferRequestBody", true); - BufferingClientHttpRequestFactory result = ClientHttpRequestFactories.get( - () -> new BufferingClientHttpRequestFactory(requestFactory), - ClientHttpRequestFactorySettings.DEFAULTS.withBufferRequestBody(false)); - assertThat(result).extracting("requestFactory").isSameAs(requestFactory); - assertThat(requestFactory).hasFieldOrPropertyWithValue("bufferRequestBody", false); - } - public static class TestClientHttpRequestFactory implements ClientHttpRequestFactory { private int connectTimeout; private int readTimeout; - private boolean bufferRequestBody; - @Override public ClientHttpRequest createRequest(URI uri, HttpMethod httpMethod) throws IOException { throw new UnsupportedOperationException(); @@ -208,10 +171,6 @@ class ClientHttpRequestFactoriesTests { this.readTimeout = timeout; } - public void setBufferRequestBody(boolean bufferRequestBody) { - this.bufferRequestBody = bufferRequestBody; - } - } public static class UnconfigurableClientHttpRequestFactory implements ClientHttpRequestFactory { diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/client/ClientHttpRequestFactorySettingsTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/client/ClientHttpRequestFactorySettingsTests.java index 8103a3ae69..c9145b7dd2 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/client/ClientHttpRequestFactorySettingsTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/client/ClientHttpRequestFactorySettingsTests.java @@ -39,7 +39,6 @@ class ClientHttpRequestFactorySettingsTests { ClientHttpRequestFactorySettings settings = ClientHttpRequestFactorySettings.DEFAULTS; assertThat(settings.connectTimeout()).isNull(); assertThat(settings.readTimeout()).isNull(); - assertThat(settings.bufferRequestBody()).isNull(); assertThat(settings.sslBundle()).isNull(); } @@ -49,7 +48,6 @@ class ClientHttpRequestFactorySettingsTests { .withConnectTimeout(ONE_SECOND); assertThat(settings.connectTimeout()).isEqualTo(ONE_SECOND); assertThat(settings.readTimeout()).isNull(); - assertThat(settings.bufferRequestBody()).isNull(); assertThat(settings.sslBundle()).isNull(); } @@ -59,17 +57,6 @@ class ClientHttpRequestFactorySettingsTests { .withReadTimeout(ONE_SECOND); assertThat(settings.connectTimeout()).isNull(); assertThat(settings.readTimeout()).isEqualTo(ONE_SECOND); - assertThat(settings.bufferRequestBody()).isNull(); - assertThat(settings.sslBundle()).isNull(); - } - - @Test - void withBufferRequestBodyReturnsInstanceWithUpdatedBufferRequestBody() { - ClientHttpRequestFactorySettings settings = ClientHttpRequestFactorySettings.DEFAULTS - .withBufferRequestBody(true); - assertThat(settings.connectTimeout()).isNull(); - assertThat(settings.readTimeout()).isNull(); - assertThat(settings.bufferRequestBody()).isTrue(); assertThat(settings.sslBundle()).isNull(); } @@ -79,7 +66,6 @@ class ClientHttpRequestFactorySettingsTests { ClientHttpRequestFactorySettings settings = ClientHttpRequestFactorySettings.DEFAULTS.withSslBundle(sslBundle); assertThat(settings.connectTimeout()).isNull(); assertThat(settings.readTimeout()).isNull(); - assertThat(settings.bufferRequestBody()).isNull(); assertThat(settings.sslBundle()).isSameAs(sslBundle); } diff --git a/spring-boot-system-tests/spring-boot-image-tests/build.gradle b/spring-boot-system-tests/spring-boot-image-tests/build.gradle index 9de3b9c9fb..e4236f1b82 100644 --- a/spring-boot-system-tests/spring-boot-image-tests/build.gradle +++ b/spring-boot-system-tests/spring-boot-image-tests/build.gradle @@ -19,6 +19,11 @@ configurations { if (dependency.requested.group.startsWith("com.fasterxml.jackson")) { dependency.useVersion("2.14.2") } + // Downgrade Spring Framework as Gradle cannot cope with 6.1.0-M1's + // multi-version jar files with bytecode in META-INF/versions/21 + if (dependency.requested.group.equals("org.springframework")) { + dependency.useVersion("6.0.10") + } } } }