File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Use of Qualifiers in Autowiring" Watch "Use of Qualifiers in Autowiring" New topic
Author

Use of Qualifiers in Autowiring

Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9344
    
    2

Ranchers,

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


SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
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: http://aspose.com/file-tools
 
subject: Use of Qualifiers in Autowiring
 
Similar Threads
[Struts2] how to redirect to the current page with param ?
Best way to update a Entity.
doubt related to "++" operator
Protect riskey Chat meetings ...
All Vowels in an Integer