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.