Closed
Description
Andy Wilkinson opened SPR-14257 and commented
When ConditionEvaluator
looks for Conditional
annotations, it doesn't find them when they are a meta-meta-annotation. The problem appears to be due to ConditionEvaluator
's use of AnnotationTypeMetadata.getAllAnnotationAttributes
which doesn't return all of the values for all of the Conditional
annotations that are present. The attached class should hopefully illustrate the behaviour that we're seeing. When run it should output:
com.example.ConditionComposition$MetaFooAndBarConfiguration [class com.example.ConditionComposition$ConditionalOnBar$BarEnabledCondition]
com.example.ConditionComposition$MetaFooAndMetaBarConfiguration []
com.example.ConditionComposition$ExplicitAnnotationConfiguration [class com.example.ConditionComposition$ConditionalOnFoo$FooEnabledCondition, class com.example.ConditionComposition$ConditionalOnBar$BarEnabledCondition]
My expectation is that all three configuration classes should produce the output that ExplicitAnnotationConfiguration
produces.
Affects: 4.2.6
Attachments:
- ConditionComposition.java (3.04 kB)
Issue Links:
- ClassPathScanningCandidateComponentProvider.findCandidateComponents fails on private meta-attributes [SPR-11091] #15717 ClassPathScanningCandidateComponentProvider.findCandidateComponents fails on private meta-attributes
- AnnotationAttributesReadingVisitor.doVisitEnd doesn't handle possible null return from AnnotationUtils.getAnnotations [SPR-12493] #17099 AnnotationAttributesReadingVisitor.doVisitEnd doesn't handle possible null return from AnnotationUtils.getAnnotations
Referenced from: commits 24f5f36, 7de2976
Backported to: 4.2.7