Why can’t we autowire static fields in spring?

We can’t autowire static fields in spring because the Spring context might not be loaded when the java class loader loads the static values.
In that case the class loader won’t properly inject the static fields in the bean and will fail.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)