Check that WebClient is available

This commit reinstanties the isWeBClientPresent() check so that
WebTestClientContextCustomizer is only added if a web client is
available.

See gh-24152
This commit is contained in:
Tobias Gesellchen
2020-11-13 18:42:27 +01:00
committed by Stephane Nicoll
parent b1678ee6ad
commit f6255cc691
3 changed files with 113 additions and 1 deletions

View File

@@ -39,7 +39,7 @@ class WebTestClientContextCustomizerFactory implements ContextCustomizerFactory
List<ContextConfigurationAttributes> configAttributes) {
SpringBootTest springBootTest = TestContextAnnotationUtils.findMergedAnnotation(testClass,
SpringBootTest.class);
return (springBootTest != null) ? new WebTestClientContextCustomizer() : null;
return (springBootTest != null && isWebClientPresent()) ? new WebTestClientContextCustomizer() : null;
}
private boolean isWebClientPresent() {