Skip to content

Latest commit

 

History

History
90 lines (56 loc) · 3.78 KB

definition_ee.asciidoc

File metadata and controls

90 lines (56 loc) · 3.78 KB

Extended Concepts for Jakarta EE

When running in Jakarta EE, the container must extend the concepts defined in [concepts] with:

  • A Jakarta EE component is a bean if the lifecycle of its instances may be managed by the container according to the lifecycle context model defined in [contexts]

  • Contextual instances of a bean may be used in EL expressions that are evaluated in the same context

  • For some Jakarta EE components - like environment resources, defined in [resources] - the developer provides only the annotations and the bean implementation is provided by the container.

Functionality provided by the container to the bean in Jakarta EE

When running in Jakarta EE, the container must extend the capabilities defined in [capabilities], by providing:

  • scoped resolution by bean name when used in a Unified EL expression, as defined by [name_resolution].

Bean types for Jakarta EE component

As managed beans, EJB session beans may have multiple bean types depending on their client-visible types. For instance, this session bean has only the local interfaces BookShop and Auditable, along with Object, as bean types, since the bean class is not a client-visible type.

@Stateful
public class BookShopBean
        extends Business
        implements BookShop, Auditable {
    ...
}

The rules for determining the (unrestricted) set of bean types for Jakarta EE components are defined in [session_bean_types] and [resource_types].

Scopes

Jakarta EE components such as servlets, EJBs and JavaBeans do not have a well-defined scope. These components are either:

  • singletons, such as EJB singleton session beans, whose state is shared between all clients,

  • stateless objects, such as servlets and stateless session beans, which do not contain client-visible state, or

  • objects that must be explicitly created and destroyed by their client, such as JavaBeans and stateful session beans, whose state is shared by explicit reference passing between clients.

CDI scopes add to Jakarta EE these missing well-defined lifecycle context as defined in [scopes].

Built-in scope types in Jakarta EE

When running in Jakarta EE, the implementations of the @RequestScoped, @ApplicationScoped and @SessionScoped annotations provided by the container, represent the standard scopes defined by the Java Servlets specification.

Default bean discovery mode for Jakarta EE

When running in Jakarta EE, If the bean discovery mode is annotated, the container must extend the rules defined in [default_bean_discovery] with:

  • bean classes of EJB sessions beans, are discovered, and

  • producer methods that are on an EJB session bean are discovered, and

  • producer fields that are on an EJB session bean are discovered, and

  • disposer methods that are on an EJB session bean are discovered, and

  • observer methods that are on an EJB session bean are discovered.

Bean names in Jakarta EE

A bean with a name may be referred to by its name in Unified EL expressions.

There is no relationship between the bean name of an EJB session bean and the EJB name of the bean.

Bean names allow the direct use of beans in JSP or JSF pages, as defined in [el]. For example, a bean with the name products could be used like this:

<h:outputText value="#{products.total}"/>

Default bean names for EJB session beans

In the circumstances listed in [default_name], the rule for determining default name for an EJB session bean are defined in [session_bean_name].