Skip to content

Instantly share code, notes, and snippets.

@MirkoRossini
Created September 28, 2016 19:58
Show Gist options
  • Save MirkoRossini/5d5a41466b774c9c6225638f5ec914c6 to your computer and use it in GitHub Desktop.
Save MirkoRossini/5d5a41466b774c9c6225638f5ec914c6 to your computer and use it in GitHub Desktop.
@Test
public void testBindMapperPrivateModuleExposedInterfaceExposeSqlSessionManager() {
/**
*/
final Module privateModule = new PrivateModule() {
@Override
protected void configure() {
final Module myBatisModule = new MyBatisModule() {
@Override
protected void initialize() {
environmentId(ENV);
install(JdbcHelper.H2_EMBEDDED);
bindDataSourceProviderType(PooledDataSourceProvider.class);
bindTransactionFactoryType(JdbcTransactionFactory.class);
addMapperClass(DummyMapper.class);
}
};
install(myBatisModule);
bind(DummyServiceInt.class).to(DummyService.class);
expose(DummyServiceInt.class);
expose(SqlSessionManager.class);
expose(DummyMapper.class);
}
};
final Injector injector = Guice.createInjector(
Stage.DEVELOPMENT, privateModule);
injector.getInstance(DummyServiceInt.class).insertValue(1);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment