Difference between Dependency (a) lookup and (b) injection or invention of control or IOC
- Dependency lookup:
- If resource of the application spending time to search and get dependent values from other resources of application then it is called dependency lookup
- Example :
- If the student get his dependent value material from instruction by asking for it then is called dependency lookup
- The way servlet / ejb component gets jdbc data source object form registry through jndi lookup operation is called dependency lookup
- In dependency lookup resource perform “pull” operation on other resource or on underlying s/w to get the dependent values
- Disadvantage: resource has to spend time to search and get dependent values
- Advantage: resource can get only required dependent values
- Dependency injection:
- if underlying s/w (or) framework server (or) special resource of application assign dependent values to resource, the moment resource is ready then it is called dependency injection or inversion of controller (IOC)
- Example :
- The way student gets his course material the moment to register for course is called dependency injection
- If jdbc data source object is assigned to servlet object by servlet container the moment servlet object is created is called dependency injection
- In dependency injection underlying s/w or container/ framework server or special resource perform “push” operation on the resource of application to assign dependent values the moment resource is ready
- Advantage: resource need not spend time to get dependent value and it can use dependent value at the moment resource is ready
- Disadvantage: both necessary and unnecessary values will be injected
- In struts the way action servlet dynamically assign form data to form bean class properties
- By creating /locating formbean class object is called dependency injection or ioc







