Breaking News: Grepper is joining You.com. Read the official announcement!
Check it out

There are different types of DI

Pragya Keshap answered on February 20, 2023 Popularity 2/10 Helpfulness 3/10

Contents


More Related Answers


There are different types of DI

0

Constructor injection: Dependencies are passed to a client class constructor. An example of the constructor injection was already shown in the preceding Car example code.

Setter injection: Dependencies are provided through setters. The following example code shows an example of the setter injection:

public class Car {

private Owner owner;

public void setOwner(Owner owner) {

this.owner = owner;

}

}

Popularity 2/10 Helpfulness 3/10 Language whatever
Source: Grepper
Tags: types whatever
Link to this answer
Share Copy Link
Contributed on Feb 20 2023
Pragya Keshap
0 Answers  Avg Quality 2/10


X

Continue with Google

By continuing, I agree that I have read and agree to Greppers's Terms of Service and Privacy Policy.
X
Grepper Account Login Required

Oops, You will need to install Grepper and log-in to perform this action.