Java Reference
In-Depth Information
Scope
Description
The @RequestScoped beans are shared for the length
of a single request. This could be an HTTP request, a
remote EJB invocation, a web services invocation, or
message-delivery to an MDB. These beans are des-
troyed at the end of the request.
@RequestScoped
@ConversationScoped The @ConversationScoped beans are shared across
multiple requests in the same HTTP session but only if
there is an active conversation maintained. Conversa-
tions are supported for JSF requests through the
javax.enterprise.context.Conversation
bean.
The @SessionScoped beans are shared between all
requests that occur in the same HTTP session and are
destroyed when the session is destroyed.
@SessionScoped
@ApplicationScoped An @ApplicationScoped bean will live for as long as
the application is running and is destroyed when the ap-
plication is shut down.
The @Dependent beans are never shared between in-
jection points. Any injection of a dependent bean is a
new instance whose lifecycle is bound to the lifecycle of
the object it is being injected into.
@Dependent
In this chapter example, we will use the RequestScoped and SessionScoped
beans to drive our simple Ticket Booking system. In the next chapter we will further
Search WWH ::




Custom Search