ManagedBeansWebApp Sample

This sample demonstrates the Java EE 6 feature of managed beans. JAX-RS root resource classes are annotated with @ManagedBean, which means EE-related resources may be injected into instances of those classes.

Contents

The sample consists of two root resource classes that are managed beans and one stateless session bean. One root resource class is managed in the default JAX-RS life-cyle of per-request and the other is managed in the lifecycle of singleton (meaning on instance per web application).
Two EE-related artifacts are injected into each root resource class instance. The first is a resource constant defined in the web.xml. The second is a stateless session EJB.

Running the Example

This sample utilizes Java EE 6 features of the GlassFish in Glassfish 3.1

If you are working with Jersey GlassFish update center module installed into your existing GlassFish instance, you will need to follow instructions at the module README file in order to deploy the example.

Otherwise, you can run the example using embedded GlassFish as follows:

Build and deploy the project by executing maven from the project directory

mvn clean package embedded-glassfish:run

From a web browser, visit:

http://localhost:8080/managed-beans-webapp