Spring Dependency Injection

What is Dependency
We say Class A has dependency on Class B if Class A is using Class B reference as Variable.

What is Dependency Injection
Classes in Java are suppose to independent to each other(As much as possible). Less dependency increases the possibility to reuse classes and to test them independently of other classes. Dependency Injection can be used to achieve this. Instead of class search for it’s dependency, In Dependency Injection Container will identify the Dependency and inject those dependency in Class dynamically.

Dependency Injection in Spring
Spring uses the Dependency Injection design pattern to define the Object dependency. Spring provide two type of dependency injection

asked Sep 1, 2015 in spring framework by rajesh
0 votes

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.