What's the difference between @Named
and @org.springframework.beans.factory.annotation.Qualifier
in spring annotation configuration?
Which can be used to give a bean name to a bean (just like 'id'
in xml configuration)?
1 Answer
@Named
is a Java standard (JSR 330), @Qualifier
is used only for Spring; latest versions of Spring recognize both. I'd use @Named
because @Qualifier
is rather used to solve ambiguities where you have two or more beans of the same type.
-
2
-
6@MuhammadGelbana you're right, there is a
javax.inject.Qualifier
, but the OP is refering toorg.springframework.beans.factory.annotation.Qualifier
– morganoMay 8, 2014 at 23:04 -
1