2 Replies Latest reply on Jul 6, 2014 4:54 AM by Eric J. Van der Velden

    Can you inject in produced object in CDI?

    Eric J. Van der Velden Newbie

      Suppose I have,


          public class Ctrl{

                  @Named @Produces public My getMy(){ return new My(); }


      I can use EL expressions referencing `my`.. So that's OK.



      But in the `My` type itself, I cannot inject, for example,


      public class My

              @Inject @Random private int randomNumber;



      The `randomNumber` field in `my` above is `null`.



      So my question is: Can you indeed not inject in a produced object, or am I doing something wrong?