The changes for #27538 include an optimization to filter out non-existing locations on startup. However, a jar may not have entries for directories, e.g. static/foo.gif
exists but static/
does not, in which case the check for the existence of classpath:static/
fails and the location is filtered out. As indicated in https://github.com/spring-projects/spring-framework/issues/27538#issuecomment-952694846 this can be the case for externally created jars that are outside the control of an application. We need to improve the check or drop the optimization.
Comment From: jhoeller
I've introduced an optimizeLocations
flag on ResourceHttpRequestHandler
for resource location filtering on startup. This flag is off by default, addressing the regression, only to be enabled in case of a consistent jar layout with directory entries (potentially to be enabled by default in Boot).
Comment From: wilkinsona
Unfortunately, Boot can't guarantee directory entries. Static resources are often loaded from a jar in BOOT-INF/lib
and its contents are out of Boot's control. This was the situation of the user who reported the regression, for example.
Comment From: jhoeller
Ok, then we'll have to leave it up to the user for the time being. Maybe we can set it in some scenarios eventually, or at least guide users towards that setting for web performance tuning.