|
1 | 1 | /*
|
2 |
| - * Copyright 2012-2021 the original author or authors. |
| 2 | + * Copyright 2012-2023 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
|
43 | 43 | import org.springframework.context.support.AbstractApplicationContext;
|
44 | 44 | import org.springframework.core.Ordered;
|
45 | 45 | import org.springframework.core.annotation.AnnotationUtils;
|
| 46 | +import org.springframework.core.annotation.MergedAnnotation; |
| 47 | +import org.springframework.core.annotation.MergedAnnotations; |
| 48 | +import org.springframework.core.annotation.MergedAnnotations.SearchStrategy; |
46 | 49 | import org.springframework.core.annotation.Order;
|
47 | 50 | import org.springframework.core.style.ToStringCreator;
|
48 | 51 | import org.springframework.core.type.AnnotationMetadata;
|
@@ -251,7 +254,9 @@ private void collectClassAnnotations(Class<?> classType, Set<Annotation> annotat
|
251 | 254 |
|
252 | 255 | private void collectElementAnnotations(AnnotatedElement element, Set<Annotation> annotations,
|
253 | 256 | Set<Class<?>> seen) {
|
254 |
| - for (Annotation annotation : element.getDeclaredAnnotations()) { |
| 257 | + for (MergedAnnotation<Annotation> mergedAnnotation : MergedAnnotations.from(element, |
| 258 | + SearchStrategy.DIRECT)) { |
| 259 | + Annotation annotation = mergedAnnotation.synthesize(); |
255 | 260 | if (!isIgnoredAnnotation(annotation)) {
|
256 | 261 | annotations.add(annotation);
|
257 | 262 | collectClassAnnotations(annotation.annotationType(), annotations, seen);
|
|
0 commit comments