diff --git a/module/spring-boot-test-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/module/spring-boot-test-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json index 3e102c043ef..43e38bd0479 100644 --- a/module/spring-boot-test-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json +++ b/module/spring-boot-test-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -17,6 +17,12 @@ "type": "java.lang.Boolean", "description": "Whether the condition evaluation report should be printed when the ApplicationContext fails to start.", "defaultValue": true + }, + { + "name": "spring.test.webtestclient.timeout", + "type": "java.time.Duration", + "description": "Maximum amount of time to wait for responses.", + "defaultValue": "5s" } ] } diff --git a/module/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/reactive/WebTestClientAutoConfigurationTests.java b/module/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/reactive/WebTestClientAutoConfigurationTests.java index d8cfed8cff7..0d356dbd50a 100644 --- a/module/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/reactive/WebTestClientAutoConfigurationTests.java +++ b/module/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)