Skip to content

How does dependency injection work in Spring?

I want to know how spring does dependency injection. I want the low level logic used.


I want to know how the object references are injected to the constructors or setter methods, is it through Reflection or some byte code level.


Configuration of dependencies are read from XML, annotations or Java DSL (JavaConfig). Then Spring DI engine wires the dependencies based on the metadata from the configuration using the Java reflection API.