Skip to content

Introduce MergedAnnotation finder methods #22569

Closed as not planned
Closed as not planned
@philwebb

Description

@philwebb

Code to locate methods on classes based on annotations currently mostly uses a combination of MethodIntrospector and AnnotatedElementUtils.

For example, in EventListenerMethodProcessor:

annotatedMethods = MethodIntrospector.selectMethods(targetType,
(MethodIntrospector.MetadataLookup<EventListener>) method ->
AnnotatedElementUtils.findMergedAnnotation(method, EventListener.class));

With the addition of the new MergedAnnotations API along with the annotation index work it might be nicer if we had a first class way to find such methods.

One possible solution would be to add finder methods to MergedAnnotation.

For example:

MergedAnnotation.find(SomeAnnotation.class).onMethodsIn(SomeCandidate.class);

Metadata

Metadata

Assignees

No one assigned

    Labels

    in: coreIssues in core modules (aop, beans, core, context, expression)status: declinedA suggestion or change that we don't feel we should currently applytype: enhancementA general enhancement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions