Created
September 28, 2016 20:01
-
-
Save MirkoRossini/35f51bb4af6ad7e2e453b11cfc9b61d2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void testBindMapperPrivateModuleExposeSqlSessionManager() { | |
/** | |
*/ | |
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(DummyService.class); | |
expose(DummyService.class); | |
expose(SqlSessionManager.class); | |
expose(DummyMapper.class); | |
} | |
}; | |
final Injector injector = Guice.createInjector( | |
Stage.DEVELOPMENT, privateModule); | |
injector.getInstance(DummyService.class).insertValue(1); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment