Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Use of Qualifiers in Autowiring

 
Joe Harry
Ranch Hand
Posts: 10106
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ranchers,

Why would I use a Qualifier attribute when I autowire my beans?
 
Freddy Wong
Ranch Hand
Posts: 959
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic