I was thinking about why Spring doesn't allow you to inject static fields. Injecting static fields looks like a wrong usage of an OOP pattern (dependency injection), also static fields belong to a Class, not to an Object;
Can someone explain technically why Sping doesn't allow (or is not able) to autowire static fields?
Kirk James wrote:I was just talking about the Spring IOC container that manages the bean instances and that cannot work with static elements.
It looks like you've assumed that "cannot" is the right word to use there. It's possible that DI can work with static members but that the designers of Spring have decided not to do that. After all there are serious architectural reasons not to do it, as you already noted.