I am new to Spring and trying to understand the behavior of PostConstruct in Spring
Could anyone help me figure out why I get NPE on c, when its called from Caller class, when I am initialzing it in the init method.
public abstract class A extends B {
private C c;
@PostConstruct
public void init() {
c = new C();
}
@Override
public D testMethod() {
c.callMethod()
}
}
@Component
public class Caller {
.....
public void method() {
// NPE on c
<code>.testMethod()
}
}