spring-framework icon indicating copy to clipboard operation
spring-framework copied to clipboard

PathMatchingResourcePatternResolver no longer follows symlinks

Open p120ph37 opened this issue 1 year ago • 0 comments

Affects: 6.0.x, 6.1.x


From 5.3.x to 6.0.x, the implementation of filesystem-searching in PathMatchingResourcePatternResolver was changed from a recursive call to java.io.File.listFiles() to a single call to java.nio.file.Files.walk(rootPath). This changed the default behavior so that PathMatchingResourcePatternResolver.getResources("file:./thisisasymlink/*.txt") no longer works.

The java.nio.file.Files.walk method can follow symlinks, but that behavior must be requested by supplying the FileVisitOption.FOLLOW_LINKS option like this: Files.walk(rootPath, FOLLOW_LINKS)

p120ph37 avatar Aug 23 '24 16:08 p120ph37