Request Dependencies in Dependent Objects

suggest change

Now that you have the providers for your different models, you need to request them. Just as Vehicle needs Motor, you have to add the @Inject annotation in the Vehicle constructor as follows:

public Vehicle(Motor motor){
    this.motor = motor;

You can use the @Inject annotation to request dependencies in the constructor, fields, or methods. In this example, I’m keeping the injection in the constructor.

Feedback about page:

Optional: your email if you want me to get back to you:

Table Of Contents