Merge pull request #31798 from aoyvx

* pr/31798:
  Update copyright year of changed file
  Use Bean ClassLoader consistently to resolve class names

Closes gh-31798
pull/32521/head
Stephane Nicoll 2 years ago
commit 043354f93b

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -100,7 +100,7 @@ class ImportAutoConfigurationImportSelector extends AutoConfigurationImportSelec
@Override @Override
protected Set<String> getExclusions(AnnotationMetadata metadata, AnnotationAttributes attributes) { protected Set<String> getExclusions(AnnotationMetadata metadata, AnnotationAttributes attributes) {
Set<String> exclusions = new LinkedHashSet<>(); Set<String> exclusions = new LinkedHashSet<>();
Class<?> source = ClassUtils.resolveClassName(metadata.getClassName(), null); Class<?> source = ClassUtils.resolveClassName(metadata.getClassName(), getBeanClassLoader());
for (String annotationName : ANNOTATION_NAMES) { for (String annotationName : ANNOTATION_NAMES) {
AnnotationAttributes merged = AnnotatedElementUtils.getMergedAnnotationAttributes(source, annotationName); AnnotationAttributes merged = AnnotatedElementUtils.getMergedAnnotationAttributes(source, annotationName);
Class<?>[] exclude = (merged != null) ? merged.getClassArray("exclude") : null; Class<?>[] exclude = (merged != null) ? merged.getClassArray("exclude") : null;
@ -124,7 +124,7 @@ class ImportAutoConfigurationImportSelector extends AutoConfigurationImportSelec
protected final Map<Class<?>, List<Annotation>> getAnnotations(AnnotationMetadata metadata) { protected final Map<Class<?>, List<Annotation>> getAnnotations(AnnotationMetadata metadata) {
MultiValueMap<Class<?>, Annotation> annotations = new LinkedMultiValueMap<>(); MultiValueMap<Class<?>, Annotation> annotations = new LinkedMultiValueMap<>();
Class<?> source = ClassUtils.resolveClassName(metadata.getClassName(), null); Class<?> source = ClassUtils.resolveClassName(metadata.getClassName(), getBeanClassLoader());
collectAnnotations(source, annotations, new HashSet<>()); collectAnnotations(source, annotations, new HashSet<>());
return Collections.unmodifiableMap(annotations); return Collections.unmodifiableMap(annotations);
} }

Loading…
Cancel
Save