tree: 7aabd16de4f41b9a9afbcd89d40ab7a336a436b2 [path history] [tgz]
  1. src/
  2. pom.xml
  3. README.MD
examples/managed-beans-webapp/README.MD

Managed Beans Example

This example demonstrates managed bean support in Jersey. JAX-RS root resource classes are annotated with @ManagedBean, which means EE-related resources may be injected into instances of those classes.

Content

The example application includes two root resource classes that are treated as Java EE managed beans. One root resource class is managed in the default JAX-RS life-cycle (one instance per request) and the other is managed in the singleton life-cycle (one instance per web application).

Two Java EE artifacts are injected into the singleton root resource. The first is a resource constant defined in the web.xml. The second is an entity manager factory to allow integration with JPA layer.

Running the Example

This sample utilizes Java EE features in GlassFish application server.

The easiest way to get the application running is to build it and deploy as follows:

mvn clean package
$AS_HOME/asadmin deploy target/managed-beans-webapp.war

From a web browser, visit: