I am getting null value when injecting a bean using autowire and calling the getter. However if I do it using ctx.getbean(name, class) (see application.java) , the value is