Closed
Description
Didier Villevalois opened SPR-10488 and commented
When using @Bean
as meta-annotation, Configuration class enhancement correctly takes the meta-annotated methods, but ConfigurationClassParser does not correctly registers @Bean
methods.
This comes from MethodMetadataReadingVisitor.visitAnnotation() :
@Override
public AnnotationVisitor visitAnnotation(final String desc, boolean visible) {
String className = Type.getType(desc).getClassName();
methodMetadataMap.add(className, this);
return new AnnotationAttributesReadingVisitor(className, this.attributeMap, null, this.classLoader);
}
Here a null metaAnnotationMap argument is passed to AnnotationAttributesReadingvisitor. I guess more things should be added to methodMetadataMap.
As a result, in ConfigurationClassParser:247 :
// process individual @Bean methods
Set<MethodMetadata> beanMethods = metadata.getAnnotatedMethods(Bean.class.getName());
for (MethodMetadata methodMetadata : beanMethods) {
configClass.addBeanMethod(new BeanMethod(methodMetadata, configClass));
}
getAnnotatedMethods() does not return methods meta-annotated with @Bean
.
Do you need a test case ? Or is this easy enough to reproduce ?
Affects: 3.2.2
Backported to: 3.2.7