Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
2 tasks done
sbrannen opened this issue Aug 23, 2023 · 0 comments
Closed
2 tasks done
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Milestone

Comments

@sbrannen
Copy link
Member

sbrannen commented Aug 23, 2023

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.
@sbrannen sbrannen added in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement labels Aug 23, 2023
@sbrannen sbrannen added this to the 6.1.0-RC1 milestone Aug 23, 2023
@sbrannen sbrannen self-assigned this Aug 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

1 participant