users@glassfish.java.net

Re: Weld/CDI issues with ManagedBeans, _at_Produces methods.

From: <glassfish_at_javadesktop.org>
Date: Tue, 05 Jan 2010 04:58:26 PST

> It is not clear from your email whether this is only
> an issue with
> JNDI look up, is that the case? for example does the
> reference to
> FirewallService get injected into the instance of
> ConfigurationBean?
>
The JNDI lookup to get ConfigurationBean always fails with a NamingException. I never get an instance of ConfigurationBean back. I tried creating a setter for FirewallService and annotating it with @Inject. The producer method is called. The annotated setter on the ConfigurationBean is not called.

> Note that you should be able to inject onto JAX-RS
> resources if you
> annotate the resource class with a CDI scope-based
> annotation, such as
> @RequestScoped, or @ManagedBean (meaning Jersey will
> defer to GF to
> instantiate but will manage the instance, by default
> in the pre-
> request scope). There is a restriction, however,
> constructor injection
> of JAX-RS references, such as UriInfo, are not
> currently supported for
> CDI constructed or managed beans.
>
Thanks, I didn't know that. I'll give that a try. Saves me from doing the JNDI call.
[Message sent by forum member 'beamso' (beamso_at_gmail.com)]

http://forums.java.net/jive/thread.jspa?messageID=378792