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

AnnotationBeanNameGenerator issuing warnings about value() declaration explicitly aliasing #34317

Open
odrotbohm opened this issue Jan 24, 2025 · 0 comments
Labels
status: waiting-for-triage An issue we've not yet triaged or decided on

Comments

@odrotbohm
Copy link
Member

Assume an annotation that declares a value() attribute explicitly aliasing an attribute other than @Component(value = "…").

@interface MyAnnotation {

  @AliasFor(annotation = Foo.class, attribute = "…")
  String value() default "";
}

If that annotation gets used with a set value (@MyAnnotation("foo")), I now see a warning:

Support for convention-based stereotype names is deprecated and will \
be removed in a future version of the framework. Please annotate the \
'value' attribute in @MyAnnotation with @AliasFor(annotation=Component.class) \
to declare an explicit alias for @Component's 'value' attribute.

This should not be issued if the value() attribute is explicitly aliased to some other attribute as @Component's value. Also, the phrasing of "convention-based stereotype names" in combination with @Component lead me to believe it's about the bean name stereotypically being derived from the class name (which made it particularly puzzling as the warning only appears with a value set, which would not trigger that convention). It turns out this term is actually referring to the default aliasing convention of the annotation attributes (the @MyAnnotation.value() conventionally being considered a redeclaration of @Component.value()). I wonder if the message's wording could be adapted to clarify this.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting-for-triage An issue we've not yet triaged or decided on
Projects
None yet
Development

No branches or pull requests

2 participants