From 35bfa16315604baddb742764448714281302600b Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Wed, 25 Mar 2015 11:04:40 -0700 Subject: [PATCH] Use file based loader with MockServletContext Update SpringApplicationContextLoader so that the MockServletContext uses FileSystemResourceLoader. This allows `/src/main/webapp` folder to be found. See gh-2654 --- .../boot/test/SpringApplicationContextLoader.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spring-boot/src/main/java/org/springframework/boot/test/SpringApplicationContextLoader.java b/spring-boot/src/main/java/org/springframework/boot/test/SpringApplicationContextLoader.java index a821c78142..ce60e0a1f4 100644 --- a/spring-boot/src/main/java/org/springframework/boot/test/SpringApplicationContextLoader.java +++ b/spring-boot/src/main/java/org/springframework/boot/test/SpringApplicationContextLoader.java @@ -39,6 +39,7 @@ import org.springframework.core.annotation.AnnotationUtils; import org.springframework.core.env.ConfigurableEnvironment; import org.springframework.core.env.MapPropertySource; import org.springframework.core.env.StandardEnvironment; +import org.springframework.core.io.FileSystemResourceLoader; import org.springframework.mock.web.MockServletContext; import org.springframework.test.context.ContextConfigurationAttributes; import org.springframework.test.context.ContextLoader; @@ -261,7 +262,8 @@ public class SpringApplicationContextLoader extends AbstractContextLoader { List> initializers, WebMergedContextConfiguration webConfiguration) { MockServletContext servletContext = new MockServletContext( - webConfiguration.getResourceBasePath()); + webConfiguration.getResourceBasePath(), + new FileSystemResourceLoader()); initializers.add(0, new ServletContextApplicationContextInitializer( servletContext)); }