javax.enterprise.context
Annotation Type Dependent


@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.

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.

Author:
Gavin King, Pete Muir



Submit a bug or feature

Copyright © 2009-2011, Oracle Corporation and/or its affiliates. All Rights Reserved. Use is subject to license terms.

Generated on 10-February-2011 12:41