简体   繁体   中英

How dependency graph works in Koin or Kodein?

I have Android/kotlin multi-module project. Some of my modules are Singletone, such as Network and Analytics modules. They need Application context in order to be initialized.

I am able to initialize Koin/Kodein in app module. However, the problem is how to inject application context into each module (since app module is not visible to Network/Analytics modules).

Basically, my app module is deoendent to other modules only.

As I recently started my project, I am evaluating Koin and Kodein to see which one is helping me the way I want. That's why I am open to switch them.

Here is no dependency graph built like in Dagger: no code generation, no reflection - all is just function-bound.

Application context is available through androidContext() method.

Modules mutual dependencies logic is described here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM