I have two @Lazy components, one initialized by the second.
Whenever I try to use @Value({"app.my.prop"})
over some variable nothing happens, the variable is empty.
If I have something like this:
@Lazy
@Repository
public class justAClassThatPerhapsCompiles{
@Value("${app.my.prop}")
String myProp;
@Lazy
@Autowired
Environment env;
void justAFuncThatSomebodyWillTryToCompileMaybe(){
env.getProperty("app.my.prop"); //env is null
System.out.println(myProp); //myProp is null
}
}
Again nothing happens, env is null at runtime.
How can I get properties inside the lazily initialized components?