I don't know if this is a bug or I'm just doing it wrong. I see nothing in the documentation that says that kodein factory bindings should be called in any way other than this:
class KodeinConfidenceTest {
@Test
fun testThatKodeinWorks() {
val kodein = Kodein {
bind<Dice>() with factory { sides: Int -> RandomDice(sides) }
}
val d:Dice = kodein.instance(5)
}
}
open class Dice
data class RandomDice(val sides:Int) : Dice()
...but this causes a NotFoundException
com.github.salomonbrys.kodein.Kodein$NotFoundException: No provider found for bind<Dice>("5") with ? { ? }
Registered in Kodein:
bind<Dice>() with factory { Int -> RandomDice }