-
Notifications
You must be signed in to change notification settings - Fork 38.3k
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
Look up @Component
stereotype names using @AliasFor
semantics
#31089
Labels
in: core
Issues in core modules (aop, beans, core, context, expression)
type: enhancement
A general enhancement
Milestone
Comments
sbrannen
added a commit
to sbrannen/spring-framework
that referenced
this issue
Aug 22, 2023
Current work on this feature can be viewed in the following feature branch: main...sbrannen:spring-framework:issues/gh-31089-Component-stereotype-names-and-AliasFor |
2 tasks
sbrannen
added a commit
that referenced
this issue
Aug 28, 2023
…liasFor When use of the deprecated feature is detected, a WARNING log message will be generated analogous to the following. WARN o.s.c.a.AnnotationBeanNameGenerator - 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 @org.springframework.context.annotation.AnnotationBeanNameGeneratorTests$ConventionBasedComponent1 with @AliasFor(annotation=Component.class) to declare an explicit alias for @component's 'value' attribute. See gh-31089 Closes gh-31093
Reopening to update the Annotations page in the wiki. |
Updated the wiki page. |
This was referenced Jan 28, 2025
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
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 inAnnotationBeanNameGenerator#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 inAnnotationBeanNameGenerator
.Related Issues
@Service
should add@AliasFor
for@Component
[SPR-16066] #20615@ControllerAdvice
[SPR-16566] #21108@Component
stereotype names in favor of@AliasFor
#31093Deliverables
AnnotationBeanNameGenerator#determineBeanNameFromAnnotation()
to look up@Component
stereotype names using@AliasFor
semantics.@Component
to inform users that custom stereotypes can make use of@AliasFor
to create an alias for@Component(value)
.The text was updated successfully, but these errors were encountered: