Is there an easy way to iterate through the regist...
# kodein
l
Is there an easy way to iterate through the registered instances? the use case is some of them might implement Initializable and I want to do initialization upon startup.
Not yet
You might be able to achieve it by hacking kodein internals somehow
l
I was able to do this, which worked:
Copy code
val di = CONFIG.direct

fun runInitializers (): Boolean {
    for (el in di.allInstances<Any>()) {
        if (el is Initializable) {
            el.initialize (CONFIG)
        }
    }
b
Ah, but this would ommit all tagged bindings ;)