GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

GeekInterview.com  >  Interview Questions  >  J2EE  >  Spring
Go To First  |  Previous Question  |  
 Spring  |  Question 2 of 2    Print  
dependency injection
what is dependency injection ??


  
Total Answers and Comments: 6 Last Update: July 01, 2008     Asked by: retheesh 
  
 Sponsored Links



 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
January 11, 2008 09:48:05   #1  
Rajeev_y69 Member Since: December 2006   Contribution: 1    

RE: dependency injection
Dependency injection or Inversion of control are the two terms used for same thing. In case of DI, we define the process of instatiating an object into a non java class generally xml file.

Instead of using new word to instatiate any object, reference of an object is retrieved from an config file.

 
Is this answer useful? Yes | No
May 11, 2008 13:53:01   #2  
Karuna Reddy Member Since: June 2007   Contribution: 28    

RE: dependency injection
Depedency Injection is nothing but IoC. dynamically issue the object when asked by the client.
 
Is this answer useful? Yes | No
May 11, 2008 13:55:39   #3  
Karuna Reddy Member Since: June 2007   Contribution: 28    

RE:
The basic concept of the Inversion of Control pattern (also known as dependency injection) is that you do not create your objects but describe how they should be created. You don't directly connect your components and services together in code but describe which services are needed by which components in a configuration file.
 
Is this answer useful? Yes | No
June 26, 2008 02:38:04   #4  
aparna210 Member Since: June 2008   Contribution: 0    

RE: dependency injection

 Objects can be injected through setter or constructor.
Dependency Injection means we can inject all the dependenciess to ur object in the xml file.

For example in order to establish connection ,Connection object needs datasource object.

So in the xml file first we declare a bean for DataSource ,in that we give parameters for connecting to database like url username passwordetc
We delare another bean named Connection in which the above declared datasource object is injected through setter or constructor.

So at the time of startup the container reads the xml file. ann all the required objects are created without the developer explicitly creating objects.
 


 
Is this answer useful? Yes | No
June 29, 2008 00:42:49   #5  
Karuna Reddy Member Since: June 2007   Contribution: 28    

RE: dependency injection
Dependency Injection is also know as IoC(Injection of control)

By using this Injectioin we can instantiates and creates the objects for the non-java class using XMl file

its bean based defination And give the instance whenever asked by the client called Dependeny Injection


Please update it, if any thing else

 
Is this answer useful? Yes | No
July 01, 2008 03:20:27   #6  
rajeevchaturvedi2007 Member Since: February 2008   Contribution: 1    

RE: dependency injection
Dependency injection is the ability to inject collobrative objects dynamically.Suppose you want to call a method of particular class, so for that you use new operator help and make object of that class and call the require method using ref. varibale of that class .But when you use Spring dependency injection , you don't have to do all these stuff, instead of that you configure a xml file in which you mention what all objects you require in you class, it will get ready for use. You don't have to create or instantiate .

cheers

Rajeev Chaturvedi

 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links



 
Sponsored Links

 
Sponsored Links

 




About Us  |   Privacy Policy  |   Terms and Conditions  |   Contact  |   Site Map  |   Add Question  |   Propose Category  |   RSS Feeds  |   Articles Sitemap  |   Site Updates  |   Add Resource

Copyright © 2005 - 2008 GeekInterview.com. All Rights Reserved
Page copy protected against web site content infringement by Copyscape