0% found this document useful (0 votes)
185 views

IOC (Inversion of Control) or Dependency Injection

The document discusses dependency injection and inversion of control in software design. It defines dependency lookup as when a resource must search for its dependent values, whereas dependency injection is when a container dynamically assigns dependencies to a resource. It provides examples of dependency injection by the JRE, Spring framework, and ActionServlet. The document notes that dependency injection is the main method to implement inversion of control, where the control of object instantiation and composition is inverted from the objects themselves to a container or framework.

Uploaded by

kasim
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
185 views

IOC (Inversion of Control) or Dependency Injection

The document discusses dependency injection and inversion of control in software design. It defines dependency lookup as when a resource must search for its dependent values, whereas dependency injection is when a container dynamically assigns dependencies to a resource. It provides examples of dependency injection by the JRE, Spring framework, and ActionServlet. The document notes that dependency injection is the main method to implement inversion of control, where the control of object instantiation and composition is inverted from the objects themselves to a container or framework.

Uploaded by

kasim
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

JAVA Means DURGA SOFT

DURGA SOFTWARE SOLUTIONS ,202 HUDA Maitrivanam, Ameerpet , Hyd. Ph: 040-64512786 Page 1
JAVA Means DURGA SOFT

IOC (Inversion of Control) or Dependency Injection:

Problem: Dependency Look Up i.e. If the resource of the application spending some time to
search and gather its dependent values required in the business logic from the other resource
of the application then it is called as Dependency Look Up. In Dependency Look Up resource
pulls its dependent values from other resources of the application.

Ex: The way we get the JDBC data resource object from JNDI registry comes under Dependency
Look Up.

In dependency look up resource cannot used dependent values directly in the business
logic. The resource must spend time to search and gather dependent values before utilizing
them in business logic.

Solution: Use Dependency Injection i.e. if underlying server software or container software or
frame work software or JRE or special resource of the application dynamically assigns its
dependent to resources then it is called as Dependency Injection.

In Dependency Injection resource can directly use the injected values in business logic
without spending time to search and gather them.

DURGA SOFTWARE SOLUTIONS ,202 HUDA Maitrivanam, Ameerpet , Hyd. Ph: 040-64512786 Page 2
JAVA Means DURGA SOFT

Ex:

a) JRE/JVM performs Dependency Injection while instantiating classes using parameterized


constructor.
b) The way ActionServlet writes form data to Form Bean class object comes under
Dependency Injection.
c) Spring container can perform Dependency Injection on Spring beans.
d) Life cycle methods, Event handling methods cannot perform Dependency Injection
because they never give choice to the programmer to pass the explicit data.

Note: Dependency Injection might be a design pattern, whereas Inversion of Control is


implemented using Dependency Injection. Dependency injection is the main method to
implement Inversion of Control.

DURGA SOFTWARE SOLUTIONS ,202 HUDA Maitrivanam, Ameerpet , Hyd. Ph: 040-64512786 Page 3
JAVA Means DURGA SOFT

DURGA SOFTWARE SOLUTIONS ,202 HUDA Maitrivanam, Ameerpet , Hyd. Ph: 040-64512786 Page 4

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy