diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/aot/AotFactoriesLoader.java b/spring-beans/src/main/java/org/springframework/beans/factory/aot/AotFactoriesLoader.java index a3f1f2051f5..a3d39aa4db8 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/aot/AotFactoriesLoader.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/aot/AotFactoriesLoader.java @@ -62,8 +62,8 @@ public class AotFactoriesLoader { ClassLoader classLoader = (beanFactory instanceof ConfigurableBeanFactory configurableBeanFactory) ? configurableBeanFactory.getBeanClassLoader() : null; this.beanFactory = beanFactory; - this.factoriesLoader = SpringFactoriesLoader.forResourceLocation(classLoader, - FACTORIES_RESOURCE_LOCATION); + this.factoriesLoader = SpringFactoriesLoader.forResourceLocation(FACTORIES_RESOURCE_LOCATION, + classLoader); } /** diff --git a/spring-core/src/main/java/org/springframework/core/io/support/SpringFactoriesLoader.java b/spring-core/src/main/java/org/springframework/core/io/support/SpringFactoriesLoader.java index 1f1737d6657..aea829b923c 100644 --- a/spring-core/src/main/java/org/springframework/core/io/support/SpringFactoriesLoader.java +++ b/spring-core/src/main/java/org/springframework/core/io/support/SpringFactoriesLoader.java @@ -296,7 +296,7 @@ public class SpringFactoriesLoader { * @see #forDefaultResourceLocation() */ public static SpringFactoriesLoader forDefaultResourceLocation(@Nullable ClassLoader classLoader) { - return forResourceLocation(classLoader, FACTORIES_RESOURCE_LOCATION); + return forResourceLocation(FACTORIES_RESOURCE_LOCATION, classLoader); } /** @@ -306,24 +306,24 @@ public class SpringFactoriesLoader { * @param resourceLocation the resource location to look for factories * @return a {@link SpringFactoriesLoader} instance * @since 6.0 - * @see #forResourceLocation(ClassLoader, String) + * @see #forResourceLocation(String, ClassLoader) */ public static SpringFactoriesLoader forResourceLocation(String resourceLocation) { - return forResourceLocation(null, resourceLocation); + return forResourceLocation(resourceLocation, null); } /** * Create a {@link SpringFactoriesLoader} instance that will load and * instantiate the factory implementations from the given location, using * the given class loader. + * @param resourceLocation the resource location to look for factories * @param classLoader the ClassLoader to use for loading resources; can be * {@code null} to use the default - * @param resourceLocation the resource location to look for factories * @return a {@link SpringFactoriesLoader} instance * @since 6.0 * @see #forResourceLocation(String) */ - public static SpringFactoriesLoader forResourceLocation(@Nullable ClassLoader classLoader, String resourceLocation) { + public static SpringFactoriesLoader forResourceLocation(String resourceLocation, @Nullable ClassLoader classLoader) { Assert.hasText(resourceLocation, "'resourceLocation' must not be empty"); ClassLoader resourceClassLoader = (classLoader != null ? classLoader : SpringFactoriesLoader.class.getClassLoader());