Annotation Interface Specializes


@Target({TYPE,METHOD}) @Retention(RUNTIME) @Documented public @interface Specializes

Indicates that a bean directly specializes another bean. May be applied to a bean class or producer method.

If a bean directly specializes a second bean, it inherits:

  • all qualifiers of the second bean, and
  • the name, if any, of the second bean.

If the second bean has a name, the bean may not declare a name using @Named. Furthermore, the bean must have all the bean types of the second bean.

  • If a bean class of a managed bean is annotated @Specializes , then the bean class must directly extend the bean class of a second managed bean. Then the first managed bean directly specializes the second managed bean.
  • If a bean class of a session bean is annotated @Specializes , then the bean class must directly extend the bean class of a second session bean. Then the first session bean directly specializes the second session bean.
  • If a producer method is annotated @Specializes, then it must be non-static and directly override another producer method. Then the first producer method directly specializes the second producer method.

If a bean is specialized by any enabled bean, the first bean is disabled.

CDI Lite implementations are not required to provide support for specialization.

Author:
Gavin King, Pete Muir
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final class 
    Supports inline instantiation of the Specializes annotation.