Guice Beginner - How to bind concrete classes?
问题 I have this class: public class House { private final Door door; private final Window window; private final Roof roof; @Inject public House(Door door, Window window, Roof roof) { this.door = door; this.window = window; this.roof = roof; } } Where Door , Window and Roof are concrete classes. Now if I want to implement a Module for this scenario, I would do it like this: public class HouseModule extends AbstractModule { @Override protected void configure() { bind(Door.class).to(Door.class);