diff --git a/spring-core/src/main/java/org/springframework/core/io/support/PathMatchingResourcePatternResolver.java b/spring-core/src/main/java/org/springframework/core/io/support/PathMatchingResourcePatternResolver.java index 753f387f6ad1..1b37859169b3 100644 --- a/spring-core/src/main/java/org/springframework/core/io/support/PathMatchingResourcePatternResolver.java +++ b/spring-core/src/main/java/org/springframework/core/io/support/PathMatchingResourcePatternResolver.java @@ -574,11 +574,16 @@ protected Set doFindPathMatchingJarResources(Resource rootDirResource, // being arbitrary as long as following the entry format. // We'll also handle paths with and without leading "file:" prefix. String urlFile = rootDirURL.getFile(); + String protocol = rootDirURL.getProtocol(); + String urlSeparator = ResourceUtils.JAR_URL_SEPARATOR; + if (ResourceUtils.URL_PROTOCOL_WAR.equals(protocol)) { + urlSeparator = ResourceUtils.WAR_URL_SEPARATOR; + } try { - int separatorIndex = urlFile.indexOf(ResourceUtils.JAR_URL_SEPARATOR); + int separatorIndex = urlFile.indexOf(urlSeparator); if (separatorIndex != -1) { jarFileUrl = urlFile.substring(0, separatorIndex); - rootEntryPath = urlFile.substring(separatorIndex + ResourceUtils.JAR_URL_SEPARATOR.length()); + rootEntryPath = urlFile.substring(separatorIndex + urlSeparator.length()); jarFile = getJarFile(jarFileUrl); } else {