ProductPromotion
Logo

Kotlin

made by https://0x3d.site

GitHub - kosi-libs/Kodein: Painless Kotlin Dependency Injection
Painless Kotlin Dependency Injection. Contribute to kosi-libs/Kodein development by creating an account on GitHub.
Visit Site

GitHub - kosi-libs/Kodein: Painless Kotlin Dependency Injection

GitHub - kosi-libs/Kodein: Painless Kotlin Dependency Injection

Maven Central Kotlin Github Actions MIT License Slack channel

KOtlin DEpendency INjection

KODEIN is a straightforward and yet very useful dependency retrieval container. it is effortless to use and configure.

KODEIN works on all Kotlin Multiplatform targets:

  • JVM / Android.
  • all Native platforms (iOS, macOS, Linux, Windows, WebAssembly).
  • Javascript / WasmJs.

KODEIN allows you to:

  • Lazily instantiate your dependencies when needed
  • Stop caring about dependency initialization order
  • Bind classes or interfaces to their instance or provider
  • Debug your dependency bindings and recursions

KODEIN provides extensions to be integrable into:

An example is always better than a thousand words:

val di = DI {
    bindProvider<Dice> { RandomDice(0, 5) }
    bindSingleton<DataSource> { SqliteDS.open("path/to/file") }
}

class Controller(private di: DI) {
    private val ds: DataSource by di.instance()
}

KODEIN is a good choice because:

  • It proposes a very simple and readable declarative DSL
  • It is not subject to type erasure (as Java is)
  • It integrates nicely with Android
  • It proposes a very kotlin-esque idiomatic API
  • It is fast and optimized (makes extensive use of inline)

Installation

Kodein is available on Maven Central.

repositories {
    mavenCentral()
}
kotlin {
    sourceSets {
        commonMain {
            dependencies {
                implementation("org.kodein.di:kodein-di:{version}")
            }
        }
    }
}

KODEIN 7+ is the current major version, but documentation is available for previous versions.

Kodein documentation

Kotlin & JVM compatibility

Kodein Kotlin JDK
7.22 2.0.+ min 11
7.21 1.9.+ min 1.8
7.20 1.8.10 min 1.8
7.19 1.8.10 min 1.8
7.18 1.8.0 min 1.8
7.17 1.8.0 min 1.8

Full table can be found here

Support

Support is held in the Kodein Slack channel (you can get an invitation to the Kotlin Slack here).

If you are using KODEIN, please let us know!

More Resources
to explore the angular.

mail [email protected] to add your project or resources here 🔥.

Related Articles
to learn about angular.

FAQ's
to learn more about Angular JS.

mail [email protected] to add more queries here 🔍.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory