1 Reply Latest reply on Aug 20, 2010 6:18 AM by Pete Muir

    EJBs and CDI Producers

    Rick Kilcoyne Newbie

      Is it possible to inject a @Produces into an @EJB?

      Let's say I have a SLSB like:

      public interface MyService {
         void fetchWidget(Long id);
      public class MyServiceBean implements MyService {
         @Inject @MyData
         EntityManager em;
         public void fetchWidget(Long id) {
            return em.find(Widget.class, id);

      And a factory that declares my Producer:

      public class EMFactory {
         static EntityManager entityManager;

      Should this work assuming the @MyData annotation has been properly defined? I've tried, but haven't had any luck. Not entirely clear to me whether this is legal or not.