Introduce optimizeLocations flag for resource location filtering on startup

This flag is off by default since it requires jar files with directory entries.

Closes gh-27624
This commit is contained in:
Juergen Hoeller
2021-11-10 14:21:48 +01:00
parent 11a0df3fd1
commit 2a268701c4
8 changed files with 188 additions and 80 deletions

View File

@@ -311,7 +311,7 @@ public class ResourceHttpRequestHandlerTests {
assertThat(this.response.getContentAsString()).isEqualTo("h1 { color:red; }");
}
@Test // gh-27538
@Test // gh-27538, gh-27624
public void filterNonExistingLocations() throws Exception {
List<Resource> inputLocations = Arrays.asList(
new ClassPathResource("test/", getClass()),
@@ -321,6 +321,7 @@ public class ResourceHttpRequestHandlerTests {
ResourceHttpRequestHandler handler = new ResourceHttpRequestHandler();
handler.setServletContext(new MockServletContext());
handler.setLocations(inputLocations);
handler.setOptimizeLocations(true);
handler.afterPropertiesSet();
List<Resource> actual = handler.getLocations();