GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  J2EE  >  Spring
Next Question 
 Spring  |  Question 1 of 2    Print  
What is Inversion of Control?

  
Total Answers and Comments: 5 Last Update: January 17, 2008     Asked by: thiagarajan 
  
 Sponsored Links

 
 Best Rated Answer
Submitted by: mohammad osman
 
Inversion of control is based on the phenomenon that says, when ever dependency betwen two classes (say class A and class B) now if A needs to access the methods of B, then following our traditional approach we go ahead and create and object of B in A, but as the fact of matter, B is there to serve A not A serving B creating objects for B , So in IOC the the the class B will try to inject its object into A rather than A creating object of B. so the control is reversed , during the run time now spring container takes care which class object to inject into other class.

Osman.

Above answer was rated as good by the following members:
JaiBharath, geeky920
July 05, 2007 07:53:57   #1  
Shailendra Tiwari        

RE: What is Inversion of Control?
IOC container is used in Spring for making bean object by application context.xml.
 
Is this answer useful? Yes | No
September 04, 2007 12:49:13   #2  
Sachin Kumar        

RE: What is Inversion of Control?
IOC term is coined by Martin Flower for describing a pattern where direct coupling between objects can be reduced by using service locator kind of architecture which is getting exploited in spring by what is called dependency Injection which says that classes don't need to call another implementaion class and bind to that only rather container will injected dependent objects of declared interface resolved at startup or by lazy loading at request time.
 
Is this answer useful? Yes | No
September 08, 2007 04:17:38   #3  
mohammad osman        

RE: What is Inversion of Control?
Inversion of control is based on the phenomenon that says when ever dependency betwen two classes (say class A and class B) now if A needs to access the methods of B then following our traditional approach we go ahead and create and object of B in A but as the fact of matter B is there to serve A not A serving B creating objects for B So in IOC the the the class B will try to inject its object into A rather than A creating object of B. so the control is reversed during the run time now spring container takes care which class object to inject into other class.

Osman.

 
Is this answer useful? Yes | NoAnswer is useful 2   Answer is not useful 0Overall Rating: +2    
November 08, 2007 08:55:42   #4  
mindfreek        

RE: What is Inversion of Control?
Inversion of control or IOC is just a term. This term is used in spring framework for its dependency injection. Its all about this much While your applications starts it will create the Objects of the Classes listed in application-servlet.xml file and serve that Objects to the classes which calling it through setter method contructor normal method. So that you don't need to create an Object of a class by yourself in that class.

Holywood principle "Don't call me i will call you"

 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    
January 16, 2008 06:06:35   #5  
siva2baba Member Since: November 2007   Contribution: 15    

RE: What is Inversion of Control?
IOC Container concept

org.springframework.beans
||
||--->|The BeanFactory interface advanced configuration mechanism capable of managing objects of any nature.
||
||
org.springframework.beans.factory.BeanFactory
||
||-->|BeanFactory is the actual representation of the Spring IoC container that is responsible for containing and otherwise managing bean

XmlBeanFactory implementation BeanFactory

XML configuration metadata +Business object appplication (interdependencies between such objects)


 
Is this answer useful? Yes | NoAnswer is useful 0   Answer is not useful 1Overall Rating: -1    


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape