Tuesday, October 31, 2017

Spring - Inversion of Control (IOC ) Programming Example with Spring xml

Spring , one of the most popular DI (Dependency Injection) framework used in Enterprise now. There are so many feature of spring because of which it is using so much in market right now but the most important and the core feature is IOC i.e Inversion of Control.

So What is Inversion Of Control (important Point for Interview as well ) - So basically IOC is as words suggest the responsibility of Creating and Maitaining the lifecycle of Object is of Spring Container only , We as Developer don't need to maintain the lifecycle of Object (in spring its called as bean).

So let see the Example of IOC in Spring-

1)Create the Java maven project in eclipse.
2) If you have created simple java project using maven , it will have below structure.
3) As per my Project you can create one package (as in my com.vp.spring)
and see the below code

4) By Watching above program you can see all the Code.

If you want to understand about IOC in depth , Read from Official Documents

Download full Project from here   

If you have any problem , leave me a comment will help you in understand.

Thanks for reading


Post a Comment