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 annotation attribute overrides in favor of @AliasFor #28760

Closed
1 task done
sbrannen opened this issue Jul 5, 2022 · 0 comments
Closed
1 task 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 Jul 5, 2022

Overview

Implicit convention-based annotation attribute overrides have been supported for a long time; however, Spring Framework 4.2 introduced support for explicit annotation attribute overrides via @AliasFor.

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 in 6.0 and remove the support in 6.2 (see #28761).

Deliverables

  • in 6.0, whenever a convention-based override 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 Jul 5, 2022
@sbrannen sbrannen added this to the 6.0.0-M5 milestone Jul 5, 2022
@sbrannen sbrannen self-assigned this Jul 5, 2022
sbrannen added a commit to sbrannen/spring-framework that referenced this issue Jul 6, 2022
sbrannen added a commit that referenced this issue Jul 8, 2022
This commit replaces convention-based annotation attribute overrides in
tests with explicit use of @AliasFor -- except for tests in spring-core,
since we still want to test our support for convention-based annotation
attribute overrides.

See gh-28760
sbrannen added a commit to sbrannen/spring-framework that referenced this issue Jul 9, 2022
The warning message logged for an annotation that still uses
convention-based overrides now includes a concrete suggestion for how
the problem may potentially be fixed.

  WARN - Support for convention-based annotation attribute overrides is
  deprecated and will be removed in Spring Framework 6.1. Please
  annotate the 'locations' attribute in
  @org.springframework.core.annotation.MergedAnnotationsTests$ConventionBasedComposedContextConfiguration
  with an appropriate @AliasFor declaration -- for example,
  @AliasFor(annotation = org.springframework.core.annotation.MergedAnnotationsTests$ContextConfiguration.class).

See spring-projectsgh-28760
@sbrannen sbrannen changed the title Deprecate convention-based annotation attribute overrides in favor of @AliasFor Deprecate convention-based annotation attribute overrides in favor of @AliasFor 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