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 15:33:22 +0200

Hi Laird,

For this to work you need to identify the resource class a managed
bean. There are three options:

1) Annotate with @ManagedBean (Jersey will defer to the app container
to instantiate and it will managed the life-cycle);

2) Annotate with @Stateless or @Singleton to make it an EJB; or

3) Annotation with with a CDI-based scope annotation such as
@RequestScoped.


There are currently some limitations for 1) and 3). Constructor
injection is not supported. We are investigating improved CDI
integration such that those limitations will be removed for 3).

Hth,
Paul.

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

> I need to know if @EJB injection is supposed to be working for a JAX-
> RS resource class in Glassfish 3.1 b04 or later.
>
> Specifically, I have a resource class that I would like to place the
> following in:
>
> @EJB // happy to either leave empty or supply the proper "lookup"
> string
> private FooManager myEjb;
>
> This does not work in JBoss. It is required by the Java EE
> specification. On Glassfish, I find that it does not work either,
> which surprises me; I feel like I've seen it working before.
>
> Any known issues around this?
>
> Thanks,
> Laird
> [Message sent by forum member 'ljnelson']
>
> http://forums.java.net/jive/thread.jspa?messageID=474333
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>