@Configurable
public TestClass(){
@Autowired SomeOtherClass otherClass;
public TestClass(Var1 var){
System.out.println(otherClass);
}
}
I using compile time weaving and call new testClass(var). i using dependency injection on the constructor like above “otherClass”. It printed out ‘null’. From my test, dependency injection ‘otherClass’ cannot be initialized in constructor. what should i do to allow dependency injection on “constructor” ?
In support of the answer by Ralph.
From the Spring Autowired documentation.
HTH