users@glassfish.java.net

Re: CDI producer field question

From: <glassfish_at_javadesktop.org>
Date: Wed, 14 Jul 2010 13:28:18 PDT

There's an interesting thread on this subject:

http://seamframework.org/Community/InjectingWithEJBOrInject

The gist of it: Assuming your EJB is a local (stateless?) session bean in a CDI enabled archive (with a beans.xml) file, CDI is smart enough to resolve the @Injection without additional help. Only for remote beans it cannot know where to look, so in that case you need an @EJB producer field (with an explicit bean name).

I would expect your example to work if you simply delete the FrobnicateProducer (or at least the @Produces annotation).

At any rate, I can confirm that I'm able to @Inject local SLSBs without problems in Glassfish 3.0.1b21. (3.0 had a visibility bug when working with multiple JARs embedded into a WAR).

Regards,

Harald
[Message sent by forum member 'hwellmann']

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