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.
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.
This sample utilizes EE6 features of the GlassFish in Glassfish v3 build 68 and later versions. This sample will not work with Glassfish v3 Prelude or Preview.
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 2 from the project directory
mvn clean package embedded-glassfish:run
Note: You need at least JDK 1.6 to be able to start embedded Glassfish V3.
From a web browser, visit:
http://localhost:8080/managed-beans-webapp