You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It's not so obvious from the documentation how you would make a koin instance
(without all the static/global mechanisms like startKoin, StandAloneKoinContext and such).
Use cases include things like:
keeping multiple isolated object graphs (eg. for a plugin based architecture)
testing in parallel
etc
Can you add something like this (either to source or to documentation):
/**
* Build a koin instance.
*
* @param application - the android.app.Application instance (for binding koin.properties)
* @param modules - modules containing bean definitions
* @param properties - configuration injected into your beans
*
* Then finished with the instance:
* theKoinInstance.koinContext.close()
*/
fun buildKoin(
application: Application,
modules: Collection<Module>,
properties: Map<String, Any>): Koin {
val koin = Koin(KoinContext(BeanRegistry(), PropertyRegistry(), InstanceFactory()))
.build(modules.toList()) <--- assuming this doesn't reference global/Standalone
.bindAdditionalProperties(properties)
koin with application
return koin
}
check the #143 about modules section, for graph isolation.
Parallel testing with gradle is not a problem. Testing in parallel with the same jvm can be problematic because Koin keeps its container with a static holder (behind the start section).
It's not so obvious from the documentation how you would make a koin instance
(without all the static/global mechanisms like
startKoin
,StandAloneKoinContext
and such).Use cases include things like:
Can you add something like this (either to source or to documentation):
If it's documentation, perhaps it should live here: https://insert-koin.io/docs/1.0/reference/starting-koin/#loading-koin-modules-without-starting-koin
The text was updated successfully, but these errors were encountered: