From fdb1ee5f97f02db1934ebcf3f5030c9258521b16 Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Wed, 27 Jul 2022 18:03:55 +0200 Subject: [PATCH] Adapt to deprecations in Spring Framework See https://github.com/spring-projects/spring-framework/issues/27954 See gh-29699 --- .../web/server/ManagementContextConfigurationImportSelector.java | 1 + .../boot/autoconfigure/AutoConfigurationExcludeFilter.java | 1 + .../boot/autoconfigure/AutoConfigurationImportSelector.java | 1 + .../autoconfigure/ImportAutoConfigurationImportSelector.java | 1 + 4 files changed, 4 insertions(+) diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/ManagementContextConfigurationImportSelector.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/ManagementContextConfigurationImportSelector.java index cc10be2f03..d54e7bc084 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/ManagementContextConfigurationImportSelector.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/ManagementContextConfigurationImportSelector.java @@ -90,6 +90,7 @@ class ManagementContextConfigurationImportSelector implements DeferredImportSele } protected List loadFactoryNames() { + @SuppressWarnings("deprecation") List factoryNames = new ArrayList<>( SpringFactoriesLoader.loadFactoryNames(ManagementContextConfiguration.class, this.classLoader)); ImportCandidates.load(ManagementContextConfiguration.class, this.classLoader).forEach(factoryNames::add); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationExcludeFilter.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationExcludeFilter.java index 53d8919970..20617ed1ee 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationExcludeFilter.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationExcludeFilter.java @@ -64,6 +64,7 @@ public class AutoConfigurationExcludeFilter implements TypeFilter, BeanClassLoad protected List getAutoConfigurations() { if (this.autoConfigurations == null) { + @SuppressWarnings("deprecation") List autoConfigurations = new ArrayList<>( SpringFactoriesLoader.loadFactoryNames(EnableAutoConfiguration.class, this.beanClassLoader)); ImportCandidates.load(AutoConfiguration.class, this.beanClassLoader).forEach(autoConfigurations::add); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationImportSelector.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationImportSelector.java index d7a6a72c4d..e93e01c13f 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationImportSelector.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationImportSelector.java @@ -179,6 +179,7 @@ public class AutoConfigurationImportSelector implements DeferredImportSelector, * @return a list of candidate configurations */ protected List getCandidateConfigurations(AnnotationMetadata metadata, AnnotationAttributes attributes) { + @SuppressWarnings("deprecation") List configurations = new ArrayList<>( SpringFactoriesLoader.loadFactoryNames(getSpringFactoriesLoaderFactoryClass(), getBeanClassLoader())); ImportCandidates.load(AutoConfiguration.class, getBeanClassLoader()).forEach(configurations::add); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/ImportAutoConfigurationImportSelector.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/ImportAutoConfigurationImportSelector.java index 1a20454469..89036c69c1 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/ImportAutoConfigurationImportSelector.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/ImportAutoConfigurationImportSelector.java @@ -96,6 +96,7 @@ class ImportAutoConfigurationImportSelector extends AutoConfigurationImportSelec } protected Collection loadFactoryNames(Class source) { + @SuppressWarnings("deprecation") List factoryNames = new ArrayList<>( SpringFactoriesLoader.loadFactoryNames(source, getBeanClassLoader())); ImportCandidates.load(source, getBeanClassLoader()).forEach(factoryNames::add);