abstractpublic class AbstractModule implements Module(Code)
A support class for
Module s which reduces repetition and results in
a more readable configuration. Simply extend this class, implement
AbstractModule.configure() , and call the inherited methods which mirror those found in
Binder . For example:
import static com.google.inject.Names.named;
public class MyModule extends AbstractModule {
protected void configure() {
bind(Foo.class).to(FooImpl.class).in(Scopes.SINGLETON);
bind(BarImpl.class);
link(Bar.class).to(BarImpl.class);
bindConstant(named("port")).to(8080);
}
}