diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java b/spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java index 979a7d1880..88714cabb2 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java @@ -1049,7 +1049,8 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto protected @Nullable Boolean isCurrentThreadAllowedToHoldSingletonLock() { String mainThreadPrefix = this.mainThreadPrefix; if (mainThreadPrefix != null) { - // We only differentiate in the preInstantiateSingletons phase. + // We only differentiate in the preInstantiateSingletons phase, using + // the volatile mainThreadPrefix field as an indicator for that phase. PreInstantiation preInstantiation = this.preInstantiationThread.get(); if (preInstantiation != null) { 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 9bef142954..8d20885cb2 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 @@ -36,6 +36,7 @@ import java.nio.file.FileSystemNotFoundException; import java.nio.file.FileSystems; import java.nio.file.FileVisitOption; import java.nio.file.Files; +import java.nio.file.NoSuchFileException; import java.nio.file.Path; import java.util.Collections; import java.util.Enumeration; @@ -871,9 +872,9 @@ public class PathMatchingResourcePatternResolver implements ResourcePatternResol rootEntryPath = (jarEntry != null ? jarEntry.getName() : ""); closeJarFile = !jarCon.getUseCaches(); } - catch (ZipException | FileNotFoundException ex) { + catch (ZipException | FileNotFoundException | NoSuchFileException ex) { // Happens in case of a non-jar file or in case of a cached root directory - // without specific subdirectory present, respectively. + // without the specific subdirectory present, respectively. return Collections.emptySet(); } } @@ -1269,7 +1270,7 @@ public class PathMatchingResourcePatternResolver implements ResourcePatternResol } /** - * Return a alternative form of the resource, i.e. with or without a leading slash. + * Return an alternative form of the resource, i.e. with or without a leading slash. * @param path the file path (with or without a leading slash) * @return the alternative form or {@code null} */