Created
September 28, 2016 19:42
-
-
Save MirkoRossini/d1fc944c183d6cbe638f4bf5d18992a6 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 testBindMapperPrivateMethod() { | |
/** | |
* Won't work: mybatis doesn't know about the service | |
*/ | |
final Module myBatisModule = new MyBatisModule() { | |
@Override | |
protected void initialize() { | |
environmentId(ENV); | |
install(JdbcHelper.H2_EMBEDDED); | |
bindDataSourceProviderType(PooledDataSourceProvider.class); | |
bindTransactionFactoryType(JdbcTransactionFactory.class); | |
addMapperClass(DummyMapper.class); | |
} | |
}; | |
final Injector injector = Guice.createInjector( | |
Stage.DEVELOPMENT, new Module[]{myBatisModule}); | |
injector.getInstance(DummyService.class).insertValueCallingPrivateMethod(1); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment