From 4daf90ada1d2bb3a0b3cd0892f8fde26cb198454 Mon Sep 17 00:00:00 2001 From: Brian Clozel Date: Mon, 27 Jul 2026 16:11:46 +0200 Subject: [PATCH] Replace TestRestTemplate with RestTestClient in integration tests Before deprecating `TestRestTemplate`, we must first stop using it in integration tests and replace it with: * `RestTestClient` when the Spring MVC infrastructure is present * `RestClient` when the test does not have Spring MVC on classpath See gh-46632 --- ...bstractSpringBootTestEmbeddedReactiveWebEnvironmentTests.java | 1 + .../test/AbstractSpringBootTestWebServerWebEnvironmentTests.java | 1 + 2 files changed, 2 insertions(+) diff --git a/integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/web/server/test/AbstractSpringBootTestEmbeddedReactiveWebEnvironmentTests.java b/integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/web/server/test/AbstractSpringBootTestEmbeddedReactiveWebEnvironmentTests.java index 65e5a2e6e2c..2a5315179e1 100644 --- a/integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/web/server/test/AbstractSpringBootTestEmbeddedReactiveWebEnvironmentTests.java +++ b/integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/web/server/test/AbstractSpringBootTestEmbeddedReactiveWebEnvironmentTests.java @@ -49,6 +49,7 @@ import static org.assertj.core.api.Assertions.assertThat; */ @AutoConfigureWebTestClient @AutoConfigureTestRestTemplate +@SuppressWarnings("removal") abstract class AbstractSpringBootTestEmbeddedReactiveWebEnvironmentTests { @LocalServerPort diff --git a/integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/web/server/test/AbstractSpringBootTestWebServerWebEnvironmentTests.java b/integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/web/server/test/AbstractSpringBootTestWebServerWebEnvironmentTests.java index 943f4e89e81..44b790b2625 100644 --- a/integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/web/server/test/AbstractSpringBootTestWebServerWebEnvironmentTests.java +++ b/integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/web/server/test/AbstractSpringBootTestWebServerWebEnvironmentTests.java @@ -50,6 +50,7 @@ import static org.assertj.core.api.Assertions.assertThat; */ @AutoConfigureRestTestClient @AutoConfigureTestRestTemplate +@SuppressWarnings("removal") abstract class AbstractSpringBootTestWebServerWebEnvironmentTests { @LocalServerPort