Is there a way to inject all the dependencies and sub-depencencies when I instantiate an object with the classic code Object object = new Object()
?
As you can see from the code below, the class A autowires the class B, the class B autowires the class C.
When I instantiate the class A this way A a = new A();
of course the class A doens't have its dependencies B, and B doens't have its and so on.
Following this example I'm able to load the dependencies of A (so B is loaded inside A), but not the relative dependencies of B.
Is there a way to do it?
Thank you
public class Start{
public void start(){
A a = new A();
}
}
public class A{
@Autowired B b;
}
public class B{
@Autowired C c;
}
public class C{
}