Turn a Java annotation into a CDI qualifier
Join the DZone community and get the full member experience.
Join For FreeA CDI qualifier is an annotation that itself is annotated with the @javax.inject.Qualifier meta-annotation. Per example, if you add the @Qualifier to the MyAnnotation (http://e-blog-java.blogspot.com/2011/04/what-is-java-annotation.html) you obtain a CDI qualifier:
@QualifierCDI provide a set of built-in qualifiers:
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
public @interface MyAnnotation
{
// Property Definitions here.
}
Qualifier | Description |
@javax.enterprise.inject.Named | This qualifier is used to un-typed access from |
@javax.enterprise.inject.New | This qualifier forces the creation of a new |
| This qualifier “belongs” to all beans and |
@javax.enterprise.inject.Default | As the qualifier name suggests, whenever a bean |
From http://e-blog-java.blogspot.com/2011/04/turn-java-annotation-into-cdi-qualifier.html
CDI
Annotation
Java (programming language)
Opinions expressed by DZone contributors are their own.
Comments