From 1e5afaf35cedcf189a7865a565fd724fd6ddc6cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Nicoll?= Date: Tue, 29 Jul 2025 12:04:17 +0200 Subject: [PATCH] Document spring.test.webtestclient.timeout Closes gh-46577 --- .../additional-spring-configuration-metadata.json | 6 ++++++ .../web/reactive/WebTestClientAutoConfigurationTests.java | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-boot-project/spring-boot-test-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json index a159ff61347..1f9673f3c45 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -11,6 +11,12 @@ "type": "java.lang.Boolean", "description": "Whether observability should be auto-configured in tests.", "defaultValue": false + }, + { + "name": "spring.test.webtestclient.timeout", + "type": "java.time.Duration", + "description": "Maximum amount of time to wait for responses.", + "defaultValue": "5s" } ] } diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/reactive/WebTestClientAutoConfigurationTests.java b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/reactive/WebTestClientAutoConfigurationTests.java index ad68bc587ae..988077e19e2 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/reactive/WebTestClientAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/reactive/WebTestClientAutoConfigurationTests.java @@ -69,6 +69,14 @@ class WebTestClientAutoConfigurationTests { }); } + @Test + void shouldHaveConsistentDefaultTimeout() { + this.contextRunner.withUserConfiguration(BaseConfiguration.class).run((context) -> { + WebTestClient webTestClient = context.getBean(WebTestClient.class); + assertThat(webTestClient).hasFieldOrPropertyWithValue("responseTimeout", Duration.ofSeconds(5)); + }); + } + @Test void shouldCustomizeTimeout() { this.contextRunner.withUserConfiguration(BaseConfiguration.class)