spring-framework icon indicating copy to clipboard operation
spring-framework copied to clipboard

Support repeatable annotations for condition evaluation [SPR-17207]

Open spring-projects-issues opened this issue 7 years ago • 1 comments

Stéphane Nicoll opened SPR-17207 and commented

Condition evaluation currently doesn't support @Repeatable. The first thing I found is ConditionEvaluator#shouldSkip calls !metadata.isAnnotated(Conditional.class.getName()) which returns true for some reason when it is invoked with a modified version of @Profile that is @Repeatable

I am not entirely sold on the idea as, for instance, adding @Profile would probably be over the top considering the profile expression we've introduced in Spring Framework 5.1. It might be useful for others, though (support for repeatable @ConfigurationProperty is quite popular on the Spring Boot issue tracker).


Affects: 5.0.8

0 votes, 5 watchers

spring-projects-issues avatar Aug 23 '18 12:08 spring-projects-issues

Juergen Hoeller commented

As for the existing behavior, a repeatable annotation is technically a container annotation with nested conditions inside... and unless we specifically check for that through the corresponding AnnotatedElementUtis variant, our common meta-annotation check is only going to search the container annotation, not the nested ones.

spring-projects-issues avatar Aug 23 '18 20:08 spring-projects-issues

The related issue has been fixed differently so there's no demand for this anymore. I'd rather not add the extra complexity.

snicoll avatar Jan 29 '25 08:01 snicoll