What is IOC and DI concept without spring?

See below programs for clear differentiation with and without IOC.

In above code we need to mention implementation class (new PuneAddressImpl ()) there itself. We can see implementation is mentioned in Student class itself.


Now same code we will write through IOC by using dependency injection.

In above code we can send implementation class from other class it may be a testing class or a any layer of our application. This is called as dependency injection.
In spring all objects are referred as a beans.



Need guided training for this topic?

Learn with mentors, projects, mock interviews, and placement support at The Kiran Academy.

Explore Courses Book Free Demo