See: Description
Interface | Description |
---|---|
Conversation |
Allows the application to manage the conversation context by marking
the current conversation as transient or long-running, specifying a conversation identifier, or setting the conversation
timeout.
|
Class | Description |
---|---|
ApplicationScoped.Literal |
Supports inline instantiation of the
ApplicationScoped annotation. |
BeforeDestroyed.Literal |
Supports inline instantiation of the
BeforeDestroyed qualifier. |
ConversationScoped.Literal |
Supports inline instantiation of the
ConversationScoped annotation. |
Dependent.Literal |
Supports inline instantiation of the
Dependent annotation. |
Destroyed.Literal |
Supports inline instantiation of the
Destroyed qualifier. |
Initialized.Literal |
Supports inline instantiation of the
Initialized qualifier. |
RequestScoped.Literal |
Supports inline instantiation of the
RequestScoped annotation. |
SessionScoped.Literal |
Supports inline instantiation of the
SessionScoped annotation. |
Exception | Description |
---|---|
BusyConversationException |
Indicates that the container has rejected a request because a concurrent request is associated with the same conversation
context.
|
ContextException |
Indicates a problem relating to context management.
|
ContextNotActiveException |
Indicates that a context is not active.
|
NonexistentConversationException |
Indicates that the conversation context could not be restored.
|
Annotation Type | Description |
---|---|
ApplicationScoped |
Specifies that a bean is application scoped.
|
BeforeDestroyed |
An event with this qualifier is fired when a context is about to be destroyed, i.e.
|
ConversationScoped |
Specifies that a bean is conversation scoped.
|
Dependent |
Specifies that a bean belongs to the dependent pseudo-scope.
|
Destroyed |
An event with this qualifier is fired when a context is destroyed, i.e.
|
Initialized |
An event with this qualifier is fired when a context is initialized, i.e.
|
NormalScope |
Specifies that an annotation type is a normal scope type.
|
RequestScoped |
Specifies that a bean is request scoped.
|
SessionScoped |
Specifies that a bean is session scoped.
|
Annotations and interfaces relating to scopes and contexts.
A scope type is a Java annotation annotated
@Scope
or
@NormalScope
.
The scope of a bean determines the lifecycle and visibility of
its instances. In particular, the scope determines:
The following built-in scopes are provided:
@Dependent
,
@RequestScoped
,
@ConversationScoped
,
@SessionScoped
,
@ApplicationScoped
,
@Singleton
.
The container provides an implementation of the Context interface for each of the built-in scopes. The built-in request, session, and application contexts support servlet, web service and EJB invocations. The built-in conversation context supports JSF requests.
For other kinds of invocations, a portable extension may define a custom context object for any or all of the built-in scopes. For example, a third-party web application framework might provide a conversation context object for the built-in conversation scope.
The context associated with a built-in scope propagates across local, synchronous Java method calls, including invocation of EJB local business methods. The context does not propagate across remote method invocations or to asynchronous processes such as JMS message listeners or EJB timer service timeouts.
Most scopes are normal scopes. Normal scopes are declared
using @NormalScope
.
If a bean has a normal scope, every client executing in a certain
thread sees the same contextual instance of the bean. This instance is
called the current instance of the bean. The operation
Context.get(javax.enterprise.context.spi.Contextual)
of the
context object for a normal scope type always returns the current
instance of the given bean.
Any scope that is not a normal scope is called a pseudo-scope.
Pseudo-scopes are declared using @Scope
.
The concept of a current instance is not well-defined in the case of
a pseudo-scope. Different clients executing in the same thread may
see different instances of the bean. In the extreme case of the
@Dependent
pseudo-scope,
every client has its own private instance of the bean.
All built-in scopes are normal scopes, except for the
@Dependent
and
@Singleton
pseudo-scopes.
A reference to a bean obtained from the container via programmatic lookup is called a contextual reference. A contextual reference for a bean with a normal scope refers to the current instance of the bean. A contextual reference for a bean are valid only for a certain period of time. The application should not invoke a method of an invalid reference.
The validity of a contextual reference for a bean depends upon whether the scope of the bean is a normal scope or a pseudo-scope:
ContextNotActiveException
is thrown
by the container.A reference to a bean obtained from the container via dependency injection is a special kind of contextual reference, called an injected reference. Additional restrictions apply to the validity of an injected reference:
javax.enterprise.inject
Copyright © 2019 JBoss by Red Hat. All rights reserved.