Skip to content

Favor more locally declared composed annotations over inherited annotations [SPR-11598] #16221

Closed
@spring-projects-issues

Description

@spring-projects-issues

Sam Brannen opened SPR-11598 and commented

Background

This issue picks up where #16100 left off.


Status Quo

The implementations of AnnotatedElementUtils and (potentially) Spring's ASM-based annotation processing currently favor inherited annotations and inherited composed annotations over composed annotations that are declared closer to the starting class passed to getAnnotationAttributes(), getAllAnnotationAttributes(), isAnnotated(), etc.

See the examples and related discussion in #16100 for details.


Deliverables

  1. Determine which use cases require special treatment with regard to annotation inheritance.
    • Known cases: @Profile and @Conditional
  2. Reinstate the changes originally introduced in AnnotatedElementUtils for Favor more locally declared composed annotations over inherited annotations in AnnotationUtils [SPR-11475] #16100 (i.e., set the searchClassHierarchy to true for all invocations of the internal process() method).
  3. Introduce special handling for the known special cases determined in deliverable Spring core JMS pom.xml #1, in order to ensure proper backwards compatibility.

Affects: 4.0 GA

Issue Links:

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions