Hello,

I'm new to Guice, and I have a constructor that I want to inject. However, 
one of the parameters for this constructor is from a class that is not in 
my control. Can I still use Guice to inject this constructor?

Here is an example of what I'm talking about. In this case the Engine class 
is not in my control, but the parameters for the Engine object are in my 
control. If the Engine class was in my control I would just add @Inject to 
the constructor for the Engine class, but in my case I can't do that.

public class Car {

    private Engine engine;
    private List<Wheel> wheels;

    @Inject
    public Car(Engine engine, List<Wheel> wheels) {
        this.engine = engine;
        this.wheels = wheels;
    }
}

-Thomas

-- 
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-guice/-/ONyOZzo67sMJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-guice?hl=en.

Reply via email to