I have this class:
public class House {
private final Door door;
private final Window window;
private final Roof roof;
@Inject
public House(
Guice's Just-In-Time binding does exactly what you want. Given your Door
, Window
and Roof
meet following requirements (quoted from the Guice documentation):
either a public, no-arguments constructor, or a constructor with the @Inject annotation
an empty Module implementation will be sufficient:
public class HouseModule extends AbstractModule {
@Override
protected void configure() {
}
}