**[Benoit](https://jira.spring.io/secure/ViewProfile.jspa?name=benbenw)** opened **[SPR-16838](https://jira.spring.io/browse/SPR-16838?redirect=false)** and commented A sort was added in #18657 but the default File#compareTo depends upon the underlying system. The ordering of the ressources returned by PathMatchingResourcePatternResolver#retrieveMatchingFiles may differ between OS (Windows, Unix). This leads to subtle bugs hard to track. This PR replace the default sort with one based on the file name. --- **Affects:** 5.0.6 **Issue Links:** - #18657 PathMatchingResourcePatternResolver should enforce consistent alphabetical sorting of directory content - #21373 java.nio.file.Path support in FileSystemResource (with regular createRelative behavior, superseding PathResource) **Referenced from:** pull request https://github.com/spring-projects/spring-framework/pull/1832, and commits https://github.com/spring-projects/spring-framework/commit/bb6ab5dc91bfc6d65c8ed7cc89f226c9bfc59df8