Skip to content

Stereotype annotations like @Service should add @AliasFor for @Component [SPR-16066] #20615

Closed
@spring-projects-issues

Description

@spring-projects-issues

Yanming Zhou opened SPR-16066 and commented

@Service is a specialization of @Component, like @GetMapping is a specialization of @RequestMapping, @Service should add @AliasFor like @GetMapping

@Component
public @interface Service
{
  @AliasFor(annotation=Component.class)
  String value() default "";
}

We can get metadata from annotation via unified code

Component component = AnnotatedElementUtils.getMergedAnnotation(clazz, @Component.class);
String beanName = component.value();

Referenced from: commits 43b5e21, 625737f

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