+

Search Tips   |   Advanced Search

Managed beans

The Managed Beans specification (JSR -316) is used to define managed beans for the Java Platform Enterprise Edition (EE) and is a part of the Java EE 6 platform.

Managed beans are container-managed objects with minimal supported services, such as resource injection, life cycle callbacks and interceptors, and have the following characteristics:

We can specify the binding information that will map resources to JNDI names using an ibm-managed-bean-bnd.xml file. The following example shows the use of the ibm-managed-bean-bnd.xml file.

<?xml version="1.0" encoding="UTF-8"?>
<managed-bean-bnd 
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
  xmlns="http://websphere.ibm.com/xml/ns/javaee"
  xsi:schemaLocation="http://websphere.ibm.com/xml/ns/javaee http://websphere.ibm.com/xml/ns/javaee/ibm-managed-bean-bnd_1_0.xsd"
  version="1.0"
>
  <managed-bean class="com.ibm.example.MyManagedBean">
    <resource-ref name="myDS" binding-name="jdbc/ds1"/>
    <resource-ref name="com.ibm.example.MyManagdBean/field" binding-name="jdbc/ds2"/>
    <message-destination-ref name="myQueue" binding-name="jms/mqQueue"/>
    <ejb-ref name="myEJB" binding-name="java:app/MyEJBModule/MyStatelessBean"/>
  </managed-bean>

  <interceptor class="com.ibm.example.MyManagedBeanInterceptor">
    <resource-ref name="interceptorDS" binding-name="jdbc/db2ds"/>
  </interceptor>
</managed-bean-bnd>

As defined by the managed bean binding schema, the ibm-managed-bean-bnd.xml file shares a subset of common element definitions with EJB bindings.

For a list of the EJB binding elements and their descriptions, see the EJB 3.0 and EJB 3.1 application bindings overview page.

  • EJB 3.0 and EJB 3.1 application bindings overview