-
Notifications
You must be signed in to change notification settings - Fork 38.5k
PathMatchingResourcePatternResolver
can no longer resolve files on Windows
#29226
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
To solve the bug the following code from method
could be replaced with the following:
|
In addition to consistent use of cleaned file paths, this revision avoids FileSystem SPI interaction, resolving NIO Path instances from URI (and FileSystemResource from Path). See gh-29226
Although this was technically a regression, that regression was not released. In light of that, I have changed the label to |
The recent switch to java.nio.file.FileSystem-based classpath scanning (see spring-projectsgh-29163) resulted in a regression when scanning the classpath in the Windows filesystem. This commit addresses this regression by introducing several workarounds for dealing with `file:` resources on Windows. See the in-line comments in this commit for details on those workarounds. This fix has been tested in the following environments. - macOS 12.6 / Java 17 Oracle (build 17.0.4.1+1-LTS-2) - macOS 12.6 / GraalVM CE 22.2.0 (build 17.0.4+8-jvmci-22.2-b06) - MS Windows 11 / Java 17 Microsoft (build 17.0.4.1+1-LTS) Closes spring-projectsgh-29226
PathMatchingResourcePatternResolver
can no longer resolve files on Windows
There is problem with latest changes on the method PathMatchingResourcePatternResolver.doFindPathMatchingFileResources. It fails on Windows with the following error:
The leading slash should be removed before calling
Path rootPath = fileSystem.getPath(rootDir);
We cannot run any application on SB 3.0.0-SNAPSHOT on Windows because of this problem.
Example of code raising the exception (after removing the leading slash it works fine):
The text was updated successfully, but these errors were encountered: