Why can’t we autowire static fields in spring?

Because when the class loader loads the static values, the Spring context is not yet necessarily loaded.
So the class loader won’t properly inject the static fields in the bean and will fail.

Leave a Comment