Skip to content

Commit 0081ce7

Browse files
reckartnoname
authored andcommitted
Set useCaches on single resources obtained directly from the resource loader before returning it from the PathMatchingResourcePatternResolver
Signed-off-by: noname <nomail>
1 parent 7a5d3a5 commit 0081ce7

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

spring-core/src/main/java/org/springframework/core/io/support/PathMatchingResourcePatternResolver.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,11 @@ public Resource[] getResources(String locationPattern) throws IOException {
392392
}
393393
else {
394394
// a single resource with the given name
395-
return new Resource[] {getResourceLoader().getResource(locationPattern)};
395+
Resource res = getResourceLoader().getResource(locationPattern);
396+
if (this.useCaches != null) {
397+
res.setUseCaches(this.useCaches);
398+
}
399+
return new Resource[] {res};
396400
}
397401
}
398402
}

0 commit comments

Comments
 (0)