Qualifiers
In some instances, the type of bean we wish to inject into our code may be an interface or a Java superclass, but we may be interested in injecting a subclass or a class implementing the interface. For cases like this, CDI provides qualifiers we can use to indicate the specific type we wish to inject into our code.
A CDI qualifier is an annotation that must be decorated with the @Qualifier
annotation. This annotation can then be used to decorate the specific subclass or interface. In this section, we will develop a Premium
qualifier for our customer bean; premium customers could get perks that are not available to regular customers, for example, discounts.
Creating a CDI qualifier with NetBeans is very easy; all we need to do is go to ...
Get Java EE 7 Development with NetBeans 8 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.