Skip to content

Commit 4b01840

Browse files
committed
Expose reflection metadata with ASM-driven method order
Issue: SPR-14505 (cherry picked from commit 0208198)
1 parent 28e114b commit 4b01840

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassParser.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,17 @@ private Set<MethodMetadata> retrieveBeanMethodMetadata(SourceClass sourceClass)
365365
try {
366366
AnnotationMetadata asm =
367367
this.metadataReaderFactory.getMetadataReader(original.getClassName()).getAnnotationMetadata();
368-
beanMethods = asm.getAnnotatedMethods(Bean.class.getName());
368+
Set<MethodMetadata> asmMethods = asm.getAnnotatedMethods(Bean.class.getName());
369+
Set<MethodMetadata> reflectionMethods = beanMethods;
370+
beanMethods = new LinkedHashSet<MethodMetadata>();
371+
for (MethodMetadata asmMethod : asmMethods) {
372+
for (MethodMetadata reflectionMethod : reflectionMethods) {
373+
if (reflectionMethod.getMethodName().equals(asmMethod.getMethodName())) {
374+
beanMethods.add(reflectionMethod);
375+
break;
376+
}
377+
}
378+
}
369379
}
370380
catch (IOException ex) {
371381
logger.debug("Failed to read class file via ASM for determining @Bean method order", ex);

0 commit comments

Comments
 (0)