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.



Ready for structured training?

Learn Java Full Stack with real projects

Live classes, practical projects, interview preparation and placement support in one guided programme.

View Java Full Stack Course Book Free Demo