From 498668fc5770ec6eda0b3aeff444e9c128a4e906 Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Wed, 27 Jul 2022 17:56:33 +0200 Subject: [PATCH] Deprecate SpringFactoriesLoader#loadFactoryNames Closes gh-27954 --- .../springframework/core/io/support/SpringFactoriesLoader.java | 2 ++ .../core/io/support/SpringFactoriesLoaderTests.java | 1 + 2 files changed, 3 insertions(+) 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 aea829b923..550f3c770f 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 @@ -268,7 +268,9 @@ public class SpringFactoriesLoader { * {@code null} to use the default * @throws IllegalArgumentException if an error occurs while loading factory names * @see #loadFactories + * @deprecated as of 6.0 in favor of {@link #load(Class, ArgumentResolver, FailureHandler)} */ + @Deprecated public static List loadFactoryNames(Class factoryType, @Nullable ClassLoader classLoader) { return forDefaultResourceLocation(classLoader).loadFactoryNames(factoryType); } diff --git a/spring-core/src/test/java/org/springframework/core/io/support/SpringFactoriesLoaderTests.java b/spring-core/src/test/java/org/springframework/core/io/support/SpringFactoriesLoaderTests.java index b9bf4c451b..5cde6c22c0 100644 --- a/spring-core/src/test/java/org/springframework/core/io/support/SpringFactoriesLoaderTests.java +++ b/spring-core/src/test/java/org/springframework/core/io/support/SpringFactoriesLoaderTests.java @@ -69,6 +69,7 @@ class SpringFactoriesLoaderTests { @Test + @Deprecated void loadFactoryNames() { List factoryNames = SpringFactoriesLoader.loadFactoryNames(DummyFactory.class, null); assertThat(factoryNames).containsExactlyInAnyOrder(MyDummyFactory1.class.getName(), MyDummyFactory2.class.getName());