@Target(value={METHOD,TYPE,FIELD}) @Retention(value=RUNTIME) @Documented @Scope @Inherited public @interface Dependent
Specifies that a bean belongs to the dependent pseudo-scope.
Beans declared with scope @Dependent behave differently to beans with other built-in scope types. When a bean is
declared to have scope @Dependent:
Every invocation of the Context.get(Contextual, CreationalContext) operation of the
context object for the @Dependent scope returns a new instance of the given bean.
Every invocation of the Context.get(Contextual) operation of the context object for the
@Dependent scope returns a null value.
The @Dependent scope is always active.
Many instances of beans with scope @Dependent belong to some other bean or Java EE component class instance and are
called dependent objects.
@Dependent injected into a field, bean constructor or initializer method is a
dependent object of the bean or Java EE component class instance into which it was injected.@Dependent injected into a producer method is a dependent object of the
producer method bean instance that is being produced.@Dependent obtained by direct invocation of an
Instance is a dependent object of the instance of Instance.
When the container destroys an instance of a bean or of any Java EE component class supporting injection, the container
destroys all its dependent objects, after the @PreDestroy callback completes and after the servlet
destroy() method is called.
Copyright © 2018,2020 Eclipse Foundation.
Use is subject to license terms.