Skip to content

Instantly share code, notes, and snippets.

@mren
Created November 19, 2010 16:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mren/f4ceddaa69b31da5f722 to your computer and use it in GitHub Desktop.
Save mren/f4ceddaa69b31da5f722 to your computer and use it in GitHub Desktop.
@ExtensionComponent
public class AppConfigurator implements ErraiConfigExtension {
private final Logger logger = LoggerFactory.getLogger(AppConfigurator.class);
public void configure(ErraiConfig config) {
final Foo foo = new FooMock();
ResourceProvider<Foo> fooAdapter = new ResourceProvider<Foo>() {
public Foo get() {
return foo;
}
};
logger.info("adding binding for: " + foo.getClass());
config.addBinding(Foo.class, fooAdapter);
}
}
public class FooModule extends AbstractModule {
@Override
protected void configure() {
bind(Foo.class).to(FooMock.class).asEagerSingleton();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment