Skip to content

Deprecate convention-based @Component stereotype names in favor of @AliasFor  #31093

Closed
@sbrannen

Description

@sbrannen

Overview

Historically, @Component stereotype names were only configurable via implicit convention-based annotation attribute overrides of the String value() attribute; however, Spring Framework 4.2 introduced support for explicit annotation attribute overrides via @AliasFor. In addition, #20615 introduced the use of @AliasFor for @Component(value) in core stereotype annotations (@Service, @Controller, @Repository, @Configuration, @RestController), but the framework did not actually rely on @AliasFor support when looking up a component name via stereotype annotations until #31089.

Since explicit overrides are favorable to implicit overrides, and since the support for convention-based overrides increases the complexity of Spring's annotation search algorithms, we will deprecate convention-based overrides for @Component stereotype names in 6.1.

Related Issues

Deliverables

  • Update Javadoc and reference documentation to inform users that convention-based overrides for @Component(value) are deprecated in favor of @AliasFor(annotation = Component.class, attribute = "value").
  • Whenever a convention-based override for @Component(value) is detected, log a warning stating the reasons mentioned above.

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