I am trying to understand the javax.inject
package and I am not clear what the javax.inject.Named
annotation is supposed to be used for. The Javadoc does not explain the the idea behind it.
Javadoc is at http://download.oracle.com/javaee/6/api/javax/inject/Named.html
I am using Spring 3.0 to write some sample programs, by putting @Named
on a bean it seems to add it to the bean factory but the Javadoc description is so light I can't tell if that is the standard behavior or Spring specific behavior.
My questions are:
- What is the difference between
@Named
and@Qualifier
- How are you supposed to tell the Runtime system a class should be injectable in other classes what's the annotation for that? The equivalent of
@Component
in Spring?
Update 1 there is an excellent explanation of @Named
and @Qualifier
at Nice article about @Named
and @Qualifier
https://dzone.com/articles/java-ee6-cdi-named-components thanks @xmedeko for linking to it the comment below.