Description
Originally raised in spring-projects/spring-boot#42929 by @milazzo-g. This looks like a problem introduced by #33712, but I'm not sure if the fix should be in framework or the third-party library.
During context loading the ResourceHttpRequestHandler
class scans all possible paths and if these do not end with "/" an IllegalArgumentException
type exception is thrown with message "Resource location does not end with slash: …" (see ResourceHttpRequestHandler@282
the call to ResourceHttpRequestHandler::assertLocationPath
) this cause several issue with various jar included (in our case camunda-webapp-webjar
7.22.0 - included by camunda-bpm-spring-boot-starter-root
7.22.0).
The path provided by the library is "classpath:/META-INF/resources/webjars/camunda" which as you can see does not contain the final "/". makes it unusable with spring-boot
6.2.0-RC3.
We temporary fixed creating a copy of org.springframework.web.servlet.resource.ResourceHttpRequestHandler
in our src folder and modifying starting from line 282 from:
ResourceHandlerUtils.assertLocationPath(location);
to:
try {
ResourceHandlerUtils.assertLocationPath(location);
} catch (Exception e) {
if (org.apache.commons.lang3.StringUtils.containsIgnoreCase(e.getMessage(), "resource location does not end with slash")){
location += "/";
}else {
throw e;
}
}
this solved the issue. Could you please fix it in a next minor?
KR.
Giuseppe.