I have seen references to this term but I can't seem to understand what it actually means. Can someone in very simple terms explain what this is? Also, is the term "dependency injection" the same thing? What exactly do they mean by dependency injection? What is the use of performing such an operation?
I guess I'm reading all these things about the Spring framework but can't really figure out why it is so useful and what it really accomplishes over the traditional approach. Thanks much
Both IoC and DI mean the same. DI means that depenedencies are injected into the code by the container (Spring , Pico, Hivemind) without you having to do that. For example your code may be having dependecy on Datasource. You will need to write the lookup code using JNDI. Let us say that you need to port you code to non -JNDI environment then you will have to replace the JNDI lookup code. If you specify this in a XML as Spring does you can change the XML file to reflect the new environment without having to change code. Advantages are it becomes easier to test different implementation just by changing the XML file, code does not manage the dependencies and reduced coupling between components. I am quite new to DI and never worked on Spring or any DI containers. I feel that there is too much hype surrounding DI.