3 Replies Latest reply on Jan 27, 2010 1:14 AM by Ian R

    Cascading injections - how do they work?

    Ian R Newbie

      Hi, I was wondering how cascading injections work and whether I'm doing something wrong with what I'm doing. It's best to explain by example.

      I have an EJB class E, which injects class C. Obviously the application is starting up and doing various injections, and is calling the constructor for class C. Class C injects class D, and wants to use class D during its construction. However I have noticed that class D has not been injected during the call to the constructor of C, which then causes a NullPointerException.

      Is it reasonable to expect that class D should have already been injected into class C during construction time? If not, how do I handle this situation (where C wants to use D during its construction)? Can I do this?