Skip to content

Commit 789329f

Browse files
committed
Revise signature of SpringFactoriesLoader.forResourceLocation(...)
When an overloaded method accepts additional "optional" arguments, we typically declare the optional arguments after the required arguments. For example, see the constructors for ClassPathResource. This commit therefore revises the signature of the overloaded forResourceLocation() method so that the optional ClassLoader argument follows the required `String resourceLocation` argument.
1 parent b611157 commit 789329f

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

spring-beans/src/main/java/org/springframework/beans/factory/aot/AotFactoriesLoader.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ public AotFactoriesLoader(ListableBeanFactory beanFactory) {
6262
ClassLoader classLoader = (beanFactory instanceof ConfigurableBeanFactory configurableBeanFactory)
6363
? configurableBeanFactory.getBeanClassLoader() : null;
6464
this.beanFactory = beanFactory;
65-
this.factoriesLoader = SpringFactoriesLoader.forResourceLocation(classLoader,
66-
FACTORIES_RESOURCE_LOCATION);
65+
this.factoriesLoader = SpringFactoriesLoader.forResourceLocation(FACTORIES_RESOURCE_LOCATION,
66+
classLoader);
6767
}
6868

6969
/**

spring-core/src/main/java/org/springframework/core/io/support/SpringFactoriesLoader.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ public static SpringFactoriesLoader forDefaultResourceLocation() {
296296
* @see #forDefaultResourceLocation()
297297
*/
298298
public static SpringFactoriesLoader forDefaultResourceLocation(@Nullable ClassLoader classLoader) {
299-
return forResourceLocation(classLoader, FACTORIES_RESOURCE_LOCATION);
299+
return forResourceLocation(FACTORIES_RESOURCE_LOCATION, classLoader);
300300
}
301301

302302
/**
@@ -306,24 +306,24 @@ public static SpringFactoriesLoader forDefaultResourceLocation(@Nullable ClassLo
306306
* @param resourceLocation the resource location to look for factories
307307
* @return a {@link SpringFactoriesLoader} instance
308308
* @since 6.0
309-
* @see #forResourceLocation(ClassLoader, String)
309+
* @see #forResourceLocation(String, ClassLoader)
310310
*/
311311
public static SpringFactoriesLoader forResourceLocation(String resourceLocation) {
312-
return forResourceLocation(null, resourceLocation);
312+
return forResourceLocation(resourceLocation, null);
313313
}
314314

315315
/**
316316
* Create a {@link SpringFactoriesLoader} instance that will load and
317317
* instantiate the factory implementations from the given location, using
318318
* the given class loader.
319+
* @param resourceLocation the resource location to look for factories
319320
* @param classLoader the ClassLoader to use for loading resources; can be
320321
* {@code null} to use the default
321-
* @param resourceLocation the resource location to look for factories
322322
* @return a {@link SpringFactoriesLoader} instance
323323
* @since 6.0
324324
* @see #forResourceLocation(String)
325325
*/
326-
public static SpringFactoriesLoader forResourceLocation(@Nullable ClassLoader classLoader, String resourceLocation) {
326+
public static SpringFactoriesLoader forResourceLocation(String resourceLocation, @Nullable ClassLoader classLoader) {
327327
Assert.hasText(resourceLocation, "'resourceLocation' must not be empty");
328328
ClassLoader resourceClassLoader = (classLoader != null ? classLoader :
329329
SpringFactoriesLoader.class.getClassLoader());

0 commit comments

Comments
 (0)