You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support multiple composed annotations on a single annotated element [SPR-13486] #17490
The findMergedAnnotation*(...) and getMergedAnnotation*(...) methods in AnnotatedElementUtils only support a single target annotation and therefore a single composed annotation.
However, there are certain scenarios for which it would be beneficial to retrieve multiple composed annotations on a single annotated element. As a concrete example, see #18054 which requests support for @Cacheable, @CacheEvict, and CachePut as merged composed annotations.
Deliverables
Introduce support in AnnotatedElementUtils for processing multiple composed annotations above a single annotated element.
Support searches for multiple merged composed annotations
Prior to this commit it was possible to search for the 1st merged
annotation above an annotated element. It was also possible to search
for annotation attributes aggregated from all annotations above an
annotated element; however, it was impossible to search for all
composed annotations above an annotated element and have the results as
synthesized merged annotations instead of a multi-map of attributes.
This commit introduces a new findAllMergedAnnotations() method in
AnnotatedElementUtils that finds all annotations of the specified type
within the annotation hierarchy above the supplied element. For each
such annotation found, it merges that annotation's attributes with
matching attributes from annotations in lower levels of the annotation
hierarchy and synthesizes the results back into an annotation of the
specified type. All such merged annotations are collected and returned
as a set.
Activity
spring-projects-issues commentedon Mar 20, 2016
Sam Brannen commented
Completed as described in the comments for GitHub commit a5139f3:
spring-projects-issues commentedon Mar 24, 2016
Sam Brannen commented
Reopening in order to introduce a
getAllMergedAnnotations()method inAnnotatedElementUtilsthat searches using get semantics.spring-projects-issues commentedon Mar 24, 2016
Sam Brannen commented
Added support for "get" search semantics in 1ec35e9