Tomas Kormanak
02/11/2022, 10:53 AMinterface Feature1 {...}
interface Feature2 {...}
class Service(): Feature1,Feature2 {...}
di {
bind<Feature1> { singleton {Service()} }
bind<Feature2> { ... same singleton as above?? }
}
romainbsl
02/11/2022, 1:38 PMimport org.kodein.di.*
interface Feature1
interface Feature2
class MyService: Feature1, Feature2
val di = DI {
bindSingleton { MyService() }
bindSingleton<Feature1> { instance<MyService>() }
bindSingleton<Feature2> { instance<MyService>() }
}
Tomas Kormanak
02/11/2022, 2:53 PM