Skip to content

Meta-@Conditional lookup does not work consistently with ASM [SPR-14257] #18829

Closed
@spring-projects-issues

Description

@spring-projects-issues

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:

Issue Links:

Referenced from: commits 24f5f36, 7de2976

Backported to: 4.2.7

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)status: backportedAn issue that has been backported to maintenance branchestype: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions