In Kodein, I have modules imported into a parent module, and sometimes the classes need an instance of Kodein so they can do injection themselves later. The problem is this code:
val parentModule = Kodein {
import(SomeService.module)
}
Where SomeService.module
needs the Kodein instance for later, but Kodein isn't yet created. Passing it later into the module seems like a bad idea.
In Kodein 3.x
I see there is the kodein-conf
module that has a global instance, but I want to avoid the global.
How do other modules or classes get the Kodein instance?
Note: this question is intentionally written and answered by the author (Self-Answered Questions), so that the idiomatic answers to commonly asked Kotlin/Kodein topics are present in SO.