Skip to content

Commit

Permalink
Use file based loader with MockServletContext
Browse files Browse the repository at this point in the history
Update SpringApplicationContextLoader so that the MockServletContext
uses FileSystemResourceLoader. This allows `/src/main/webapp` folder
to be found.

See spring-projectsgh-2654
  • Loading branch information
philwebb committed Mar 25, 2015
1 parent 219317e commit 35bfa16
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
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;
Expand Down Expand Up @@ -261,7 +262,8 @@ private void addMockServletContext(
List<ApplicationContextInitializer<?>> initializers,
WebMergedContextConfiguration webConfiguration) {
MockServletContext servletContext = new MockServletContext(
webConfiguration.getResourceBasePath());
webConfiguration.getResourceBasePath(),
new FileSystemResourceLoader());
initializers.add(0, new ServletContextApplicationContextInitializer(
servletContext));
}
Expand Down

0 comments on commit 35bfa16

Please sign in to comment.