On Nov 12, 2009, at 5:32 PM, Ori Dagan wrote:
> How exactly does this release integrates with EJB3.1?
> More specifically, does it support EJB injection to resources out of
> the box? (I'm currently using my own InjectableProvider for that)
> I know Jersey supports exposing EJBs as root resources since 1.1.0-
> ea. Anything new on this front?
>
You can now do this:
@Path("foo")
@ManagedBean
public class MyResource {
@EJB MyEJB ejb;
@Path("sub")
public MyEJB getSub() {
return ejb;
}
}
@Stateless
public class MyEJB {
@Context UriInfo ui;
...
}
When you annotate a resource class with @ManagedBean then injection of
EE-related resources (if present) is supported. In the above the
MyResource class will be managed in the scope of per-request.
See here for a really simple example:
http://download.java.net/maven/2/com/sun/jersey/samples/managed-beans-webapp/1.1.4/managed-beans-webapp-1.1.4-project.zip
Paul.
> Thanks,
> Ori Dagan