Explain Dependency Injection and its types?

devquora
devquora

Posted On: Feb 22, 2018

 

    1 Answer Written

  •  devquora
    Answered by Venkatesh

    Dependency injection is a process where one static method or an object provides the dependencies of another object. Dependency injection is an object that can be used as a service. Dependency Injection can also be defined as the job of transferring an object to someone else by directly employing a dependency.

    There is a total of three variants of Dependency Injection. They are:

    1. Setter Injection: In this type of dependency, the client represents a method of the setter that an injector implies to insert the dependency.
    2. Interface Injection: This dependency offers an injector method that will insert the dependency into the client that is passed to them.
    3. Constructor Injection: This type of dependency is provided by the class constructors.

Related Questions

Please Login or Register to leave a response.

Related Questions

NIIT Technologies Java Interview Questions

What is abstraction?

Abstraction is basically used to separate the useless data from the essential ones. Only the important things that need to be shown to the users are only being exposed. Here in these issues, the users...