Annotation Interface AddBean


Add a CDI bean to the container.

This annotation can be repeated.

If used on a method, the container will be reset regardless of the test lifecycle.

The bean scope is defined as follows:

  • If a scope is set with value(), it overrides any scope defined on the bean
  • Otherwise, the scope defined on the bean is used
  • If the bean does not define a scope, ApplicationScoped is used
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    The bean class.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Class<? extends Annotation>
    Override the bean scope.
  • Element Details

    • value

      Class<?> value
      The bean class.
      Returns:
      bean class
    • scope

      Class<? extends Annotation> scope
      Override the bean scope.
      Returns:
      scope class
      Default:
      java.lang.annotation.Annotation.class