3 Replies Latest reply on Sep 1, 2010 8:55 AM by pmuir

    Invokation of Producer Methods

    nimo22

      I have a Bean A and B.


      A has itself a Producer-Method a1 (@Produces).
      B has itself a Producer-Method b1 (@Produces).


      Now, A injects a (new Instance of) B.


      Does the Container invokes the Producer-Method a1 automatically when A is instantiated ?


      Does the Container invokes the Producer-Method b1 automatically when A injects B ?

        • 1. Re: Invokation of Producer Methods
          nimo22

          Is CDI-@Produces the same as Seams @Factory ?

          • 2. Re: Invokation of Producer Methods
            pmuir

            nimo mayr wrote on Aug 27, 2010 08:37:


            I have a Bean A and B.

            A has itself a Producer-Method a1 (@Produces).
            B has itself a Producer-Method b1 (@Produces).

            Now, A injects a (new Instance of) B.

            Does the Container invokes the Producer-Method a1 automatically when A is instantiated ?


            Assuming that these are all dependent scoped, then yes.



            Does the Container invokes the Producer-Method b1 automatically when A injects B ?


            No, never.

            • 3. Re: Invokation of Producer Methods
              pmuir

              nimo mayr wrote on Aug 27, 2010 08:38:


              Is CDI-@Produces the same as Seams @Factory ?


              Similar, not the same.