If I have a class variable foo, injected via Spring and I use foo to initialize another class variable like below, why does it throw a NullPointerException? However, if I perform the initialization in a method call of the class, it works fine.
class Baz {
   @In
   Object foo;
   Object bar = foo.someMethod();
}
 
     
    