Skip to content

JSR-330 support for component detection is inconsistent [SPR-6465] #11131

Closed
@spring-projects-issues

Description

@spring-projects-issues

Eberhard Wolff opened SPR-6465 and commented

If I annotate a class using @Named it is instantiated by context:component-scan . However, @Named is just an example for an @Qualifier annotated Annotation. The JavaDoc for @Qualifier states that the specification only covers using such annotations on fields and methods, classes are optional. So even though this behavior does not contradict the specification it is not required either.

But if @Named means that a class is implemented by context:component-scan the same should work for my own @Qualifier annotated Annotation as well. That is not the case.

Also a class annotated with @Singleton is not instantiated by context:component-scan and probably other Annotations that are marked with @Scope work the same way. I think it would be more logical to have these annotations work with context:component-scan than the @Named annotation as they clearly belong to implementation classes which @Named does not. But again this is not covered by the spec.


Affects: 3.0 RC2

1 votes, 3 watchers

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