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 f234a7ad35..1a20454469 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 @@ -105,7 +105,7 @@ class ImportAutoConfigurationImportSelector extends AutoConfigurationImportSelec @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; @@ -129,7 +129,7 @@ class ImportAutoConfigurationImportSelector extends AutoConfigurationImportSelec 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); }