Hi folks, It appears that the “createOnStart” attr...
# koin
b
Hi folks, It appears that the “createOnStart” attribute of this Koin annotation
@Singleton(createdAtStart = true)
doesn’t do what I expect (eagerly create the class instance) unless I call
createEagerInstances()
like such:
Copy code
koin {
        modules(TheModule().module)
        createEagerInstances()
    }
Is that expected? Why have 2 distinct names (createAtStart and Eager) and 2 requirements for a single effect? Thanks
a
do you use
koinApplication
or
startKoin
to start Koin?
b
Neither of both. I have a KTor application in which I install Koin in the main KTor module as such:
Copy code
fun Application.mainModule() {
    install(Koin) 
}
And in (various) other KTor modules I start a koin context as follows:
Copy code
fun Application.featureModule() {
    koin {
        modules(ModuleA().module, ModuleB().module)
    }
}