File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Spring and the fly likes Use of Qualifiers in Autowiring Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Use of Qualifiers in Autowiring" Watch "Use of Qualifiers in Autowiring" New topic

Use of Qualifiers in Autowiring

Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9243


Why would I use a Qualifier attribute when I autowire my beans?

SCJP 1.4, SCWCD 1.4 - Hints for you, SCBCD Hints - Demnachst, SCDJWS - Auch Demnachst
Did a rm -R / to find out that I lost my entire Linux installation!
Freddy Wong
Ranch Hand

Joined: Sep 11, 2006
Posts: 959

@Autowired is fundamentally about type-driven injection. If you have more than one beans with that have the same type, you need to use @Qualifier to tell which bean that you're referring to.

I prefer to use @Resource for such case, though.

SCJP 5.0, SCWCD 1.4, SCBCD 1.3, SCDJWS 1.4
My Blog
I agree. Here's the link:
subject: Use of Qualifiers in Autowiring
Similar Threads
doubt related to "++" operator
All Vowels in an Integer
Best way to update a Entity.
Protect riskey Chat meetings ...
[Struts2] how to redirect to the current page with param ?