I'm trying to inject instances of an interface usi...
# kodein
a
I'm trying to inject instances of an interface using the class name a la Class.forName(...).newInstance()... I understand that you can do something like...
val kodeinContainer = DI {
bind<MyInterface>(tag = "com.dude.MyInterfaceImpl1") with provider {MyInterfaceImpl1()}
bind<MyInterface>(tag = "com.dude.MyInterfaceImpl2") with provider {MyInterfaceImpl2()}
}
but can you do this dynamically? For example, like....
object MyInjector {
val kodeinContainer = DI {}
}
fun main() {
MyInnjector.kodeinContainer.bind<...>(...) ...
}
s
a
Mucho thanks!!
👍 1