From eb9ee3f8d9f85428f95c7f6cf0c9454e7373a845 Mon Sep 17 00:00:00 2001 From: Tobias Gesellchen Date: Fri, 13 Nov 2020 18:42:27 +0100 Subject: [PATCH] Ensure the WebClient to be present before enabling the WebTestClientContextCustomizer --- .../reactive/server/WebTestClientContextCustomizerFactory.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/web/reactive/server/WebTestClientContextCustomizerFactory.java b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/web/reactive/server/WebTestClientContextCustomizerFactory.java index b8d4216640c7..8582af1bb3e5 100644 --- a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/web/reactive/server/WebTestClientContextCustomizerFactory.java +++ b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/web/reactive/server/WebTestClientContextCustomizerFactory.java @@ -39,7 +39,7 @@ public ContextCustomizer createContextCustomizer(Class testClass, List configAttributes) { SpringBootTest springBootTest = TestContextAnnotationUtils.findMergedAnnotation(testClass, SpringBootTest.class); - return (springBootTest != null) ? new WebTestClientContextCustomizer() : null; + return (springBootTest != null && isWebClientPresent()) ? new WebTestClientContextCustomizer() : null; } private boolean isWebClientPresent() {