yccheng
06/21/2018, 4:15 PMstreetsofboston
06/22/2018, 1:19 AMval kodein = Kodein {
bind<SomeConnectionPool>() with provider { SomeConnectionPool.obtain() } // closeables
bind<SomeResource>() with provider { SomeResource.obtain() } // closables
bind<SomeService>() with singleton { SomeService(provider()) }
bind<SomeOtherService>() with singleton { SomeOtherService(provider()) }
}
And the code of your obtain()
methods will make sure that only non-closed connections and resources are returned, they'll manage the pool(s).yccheng
06/24/2018, 2:32 AM