Remove Servlet-specific static locations

This commit removes the Servlet root context from the default values for
the `spring.resources.static-locations` configuration property. Servlet
and non-Servlet applications are sharing this property.

The Servlet root context is automatically configured as a resource
location for Spring MVC based applications.

Closes gh-9240
This commit is contained in:
Brian Clozel
2017-09-13 15:18:33 +02:00
parent eb4a9d87fd
commit 9dd3fb70e2
5 changed files with 79 additions and 89 deletions

View File

@@ -127,7 +127,7 @@ public class WebFluxAutoConfigurationTests {
SimpleUrlHandlerMapping.class);
assertThat(hm.getUrlMap().get("/**")).isInstanceOf(ResourceWebHandler.class);
ResourceWebHandler staticHandler = (ResourceWebHandler) hm.getUrlMap().get("/**");
assertThat(staticHandler.getLocations()).hasSize(5);
assertThat(staticHandler.getLocations()).hasSize(4);
assertThat(hm.getUrlMap().get("/webjars/**"))
.isInstanceOf(ResourceWebHandler.class);
ResourceWebHandler webjarsHandler = (ResourceWebHandler) hm.getUrlMap()
@@ -146,7 +146,7 @@ public class WebFluxAutoConfigurationTests {
.isInstanceOf(ResourceWebHandler.class);
ResourceWebHandler staticHandler = (ResourceWebHandler) hm.getUrlMap()
.get("/static/**");
assertThat(staticHandler.getLocations()).hasSize(5);
assertThat(staticHandler.getLocations()).hasSize(4);
}
@Test

View File

@@ -442,7 +442,7 @@ public class WebMvcAutoConfigurationTests {
.withPropertyValues("spring.resources.static-locations=classpath:/static")
.run((context) -> assertThat(
getFaviconMappingLocations(context).get("/**/favicon.ico"))
.hasSize(2));
.hasSize(3));
}
@Test