Skip to content

Look up @Component stereotype names using @AliasFor semantics #31089

Closed
@sbrannen

Description

@sbrannen

Overview

Although #20615 introduced the use of @AliasFor for @Component(value) in stereotype annotations (@Service, @Controller, @Repository, @Configuration, @RestController), the framework does not actually rely on @AliasFor support when looking up a component name via stereotype annotations. Rather, the framework has custom annotation parsing logic in AnnotationBeanNameGenerator#determineBeanNameFromAnnotation() which effectively ignores explicit annotation attribute overrides configured via @AliasFor.

Thus, although we can introduce the use of @AliasFor in @ControllerAdvice and @RestControllerAdvice to create aliases for @Component(value) (see #21108), those aliases will not be honored unless we revise the algorithm in AnnotationBeanNameGenerator.

Related Issues

Deliverables

  • Revise AnnotationBeanNameGenerator#determineBeanNameFromAnnotation() to look up @Component stereotype names using @AliasFor semantics.
  • Update documentation for @Component to inform users that custom stereotypes can make use of @AliasFor to create an alias for @Component(value).

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