dcsimg
June 19, 2018
Hot Topics:

End Ambiguous Dependencies Errors with CDI Qualifiers

  • March 17, 2011
  • By Glen Kunene
  • Send Email »
  • More Articles »

Java EE 6 introduced Contexts and Dependency Injection (CDI) largely to facilitate typesafe dependency injection. In particular, CDI qualifiers -- Java annotations that are themselves annotated with the @javax.inject.Qualifier meta-annotation -- address the ambiguous injection dependencies errors that occur when you need more than one instance of a bean type. Qualifiers annotate bean types and injection points that differentiate between types.

In his Java Boutique article CDI Qualifiers: Java EE 6 Annotations to End Ambiguous Dependencies, Leonard Anghel explains the following types of qualifiers, as well as how to work with multiple qualifiers:

  • built-in qualifiers
  • qualifiers defined by user
  • qualifiers with members

He summarizes the value of qualifiers this way:

...when you need more than one bean that implements the same bean type, you can qualify an injection point to specify exactly which bean must be injected.

Read the full story at JavaBoutique:
CDI Qualifiers: Java EE 6 Annotations to End Ambiguous Dependencies



Originally published on https://www.developer.com.


Comment and Contribute

 


(Maximum characters: 1200). You have characters left.

 

 


Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

By submitting your information, you agree that developer.com may send you developer offers via email, phone and text message, as well as email offers about other products and services that developer believes may be of interest to you. developer will process your information in accordance with the Quinstreet Privacy Policy.

Sitemap

×
We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.
Thanks for your registration, follow us on our social networks to keep up-to-date