https://github.com/vantoozz/dikt
Dependency Injection library for Kotlin
https://github.com/vantoozz/dikt
dependency-injection kotlin
Last synced: 19 days ago
JSON representation
Dependency Injection library for Kotlin
- Host: GitHub
- URL: https://github.com/vantoozz/dikt
- Owner: vantoozz
- License: mit
- Created: 2022-02-14T22:15:32.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2025-06-05T15:55:50.000Z (about 1 month ago)
- Last Synced: 2025-06-05T16:44:56.987Z (about 1 month ago)
- Topics: dependency-injection, kotlin
- Language: Kotlin
- Homepage:
- Size: 368 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# Dikt
Dependency Injection library for Kotlin
[](https://mvnrepository.com/artifact/io.github.vantoozz/dikt/latest)
[](https://github.com/vantoozz/dikt/actions/workflows/build.yml)
[](https://codecov.io/gh/vantoozz/dikt)```kotlin
import io.github.vantoozz.dikt.dikt
import io.github.vantoozz.dikt.putdata class DBConnection( // Some fake service
val url: String,
)class MyService( // Another service
private val db: DBConnection, // depending on the fake one
) {
fun run() =
println("Connecting to ${db.url}")
}fun main() {
val container = dikt { // We're creating a container object
put { // and putting a definition
DBConnection("some_url") // of the fake service
} // into it
}val myService = container[MyService::class] // And then the container
// creates an object for usmyService?.run() // Prints "Connecting to some_url"
}
```