Skip to content

Commit 0208198

Browse files
committed
Expose reflection metadata with ASM-driven method order
Issue: SPR-14505
1 parent fd41f63 commit 0208198

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
@@ -364,7 +364,17 @@ private Set<MethodMetadata> retrieveBeanMethodMetadata(SourceClass sourceClass)
364364
try {
365365
AnnotationMetadata asm =
366366
this.metadataReaderFactory.getMetadataReader(original.getClassName()).getAnnotationMetadata();
367-
beanMethods = asm.getAnnotatedMethods(Bean.class.getName());
367+
Set<MethodMetadata> asmMethods = asm.getAnnotatedMethods(Bean.class.getName());
368+
Set<MethodMetadata> reflectionMethods = beanMethods;
369+
beanMethods = new LinkedHashSet<>();
370+
for (MethodMetadata asmMethod : asmMethods) {
371+
for (MethodMetadata reflectionMethod : reflectionMethods) {
372+
if (reflectionMethod.getMethodName().equals(asmMethod.getMethodName())) {
373+
beanMethods.add(reflectionMethod);
374+
break;
375+
}
376+
}
377+
}
368378
}
369379
catch (IOException ex) {
370380
logger.debug("Failed to read class file via ASM for determining @Bean method order", ex);

0 commit comments

Comments
 (0)