Skip to content
Advertisement

How does dependency injection work in Spring?

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

Updates:

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.

Advertisement

Answer

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.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement