From abe938eb2c59dc991395198aee150b8cfae59650 Mon Sep 17 00:00:00 2001 From: aoyvx <1580319665@qq.com> Date: Wed, 20 Jul 2022 14:09:04 +0800 Subject: [PATCH 1/2] Use Bean ClassLoader consistently to resolve class names See gh-31798 --- .../autoconfigure/ImportAutoConfigurationImportSelector.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 bfbae2a75037..f0d23aadd793 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 @@ -100,7 +100,7 @@ protected Collection loadFactoryNames(Class source) { @Override protected Set getExclusions(AnnotationMetadata metadata, AnnotationAttributes attributes) { Set exclusions = new LinkedHashSet<>(); - Class source = ClassUtils.resolveClassName(metadata.getClassName(), null); + Class source = ClassUtils.resolveClassName(metadata.getClassName(), getBeanClassLoader()); for (String annotationName : ANNOTATION_NAMES) { AnnotationAttributes merged = AnnotatedElementUtils.getMergedAnnotationAttributes(source, annotationName); Class[] exclude = (merged != null) ? merged.getClassArray("exclude") : null; @@ -124,7 +124,7 @@ protected Set getExclusions(AnnotationMetadata metadata, AnnotationAttri protected final Map, List> getAnnotations(AnnotationMetadata metadata) { MultiValueMap, Annotation> annotations = new LinkedMultiValueMap<>(); - Class source = ClassUtils.resolveClassName(metadata.getClassName(), null); + Class source = ClassUtils.resolveClassName(metadata.getClassName(), getBeanClassLoader()); collectAnnotations(source, annotations, new HashSet<>()); return Collections.unmodifiableMap(annotations); } From 585a57be76f46331c22bf6449835f43b30761473 Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Wed, 20 Jul 2022 09:45:57 +0200 Subject: [PATCH 2/2] Update copyright year of changed file See gh-31798 --- .../autoconfigure/ImportAutoConfigurationImportSelector.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 f0d23aadd793..10f680548de0 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 @@ -1,5 +1,5 @@ /* - * Copyright 2012-2021 the original author or authors. + * Copyright 2012-2022 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License.