From 79b81a95c8341ae509c62206ad0cea80b0255366 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Wed, 4 May 2016 17:15:16 +0100 Subject: [PATCH] Use SpringBootContextLoader for tests annotated with @WebMvcTest MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously, tests annotated with @WebMvcTest would use Spring Framework’s WebDelegatingSmartContextLoader. This meant that SpringApplication was not used to create the application context. One effect of this was that Spring Boot’s logging system was not initialized and large quantities of debug log output was produced due to Logback’s default behaviour. This commit updates WebMvcTestContextBootstrapper so that it uses SpringBootContextLoader. This aligns the behaviour of @WebMvcTest with the behaviour of @SpringBootTest and @DataJpaTest. Closes gh-5847 --- .../web/servlet/WebMvcTestContextBootstrapper.java | 8 -------- 1 file changed, 8 deletions(-) diff --git a/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/web/servlet/WebMvcTestContextBootstrapper.java b/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/web/servlet/WebMvcTestContextBootstrapper.java index 524cec1029..509a77eacd 100644 --- a/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/web/servlet/WebMvcTestContextBootstrapper.java +++ b/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/web/servlet/WebMvcTestContextBootstrapper.java @@ -17,10 +17,8 @@ package org.springframework.boot.test.autoconfigure.web.servlet; import org.springframework.boot.test.context.SpringBootTestContextBootstrapper; -import org.springframework.test.context.ContextLoader; import org.springframework.test.context.MergedContextConfiguration; import org.springframework.test.context.TestContextBootstrapper; -import org.springframework.test.context.web.WebDelegatingSmartContextLoader; import org.springframework.test.context.web.WebMergedContextConfiguration; /** @@ -30,12 +28,6 @@ import org.springframework.test.context.web.WebMergedContextConfiguration; */ class WebMvcTestContextBootstrapper extends SpringBootTestContextBootstrapper { - @Override - protected Class getDefaultContextLoaderClass( - Class testClass) { - return WebDelegatingSmartContextLoader.class; - } - @Override protected MergedContextConfiguration processMergedContextConfiguration( MergedContextConfiguration mergedConfig) {