users@glassfish.java.net

Re: JAX-RS on Glassfish 3.1: _at_EJB injection?

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Tue, 15 Jun 2010 16:03:06 +0200

On Jun 15, 2010, at 3:53 PM, glassfish_at_javadesktop.org wrote:

>> For this to work you need to identify the resource
>> class a managed
>> bean. There are three options:
>
> Hi, Paul; thanks for the quick reply. Is this mechanism--which I
> have no problem with--mandated by the Java EE specification, or is
> it simply a short term issue with Jersey?

>
> That is, does the specification indicate (I didn't see where) that
> such additional annotations are required, or is this simply
> something we have to do because Jersey isn't yet mature enough in
> this regard to honor the spec requirements?
>

It is spec compliant. But we still have some work to do to honor some
optional requirements.

For JAX-RS 1.1 we were very conservative with CDI because it was
standardized very late in the process of the Java EE 6 schedule. This
is why the EG did not mandate that the JAX-RS artifacts can be used
with @Inject and hence constructor injection may not be supported. It
is optional.

JAX-RS defines it's own programming model that has some restrictions
with @ManagedBean and CDI thus you cannot always expect existing JAX-
RS applications to deploy if the JAX-RS components automatically
become managed beans or CDI managed beans when CDI is enabled. Hence
why those annotations previously referred to are explicitly required.

One thing we overlooked was a deployment option to say "all root
resource and provider classes are implicitly managed in the
@RequestScope, unless otherwise managed explicitly". So for this we
are considering a jersey-specific deployment option. This requires
some deep integration with CDI to modify the bean model.

Paul.