kodeinject alternatives and similar libraries
Based on the "Dependency Injection" category.
Alternatively, view kodeinject alternatives based on common mentions on social networks and blogs.
-
koin
Koin - a pragmatic lightweight dependency injection framework for Kotlin & Kotlin Multiplatform -
injekt
(Deprecated, @see Kodein) Dependency Injection / Object Factory for Kotlin. -
Katana
Lightweight, minimalistic dependency injection library for Kotlin & Android -
kotlin-guiced
Convenience Kotlin API over the Google Guice DI Library
Appwrite - The open-source backend cloud platform
Do you think we are missing an alternative of kodeinject or a related project?
README
kodeinject

A small library allowing constructor dependency injection for applications using Kodein.
Usage
Add dependency
Maven
<dependency>
<groupId>pw.kmp</groupId>
<artifactId>kodeinject</artifactId>
<version>1.2.2</version>
</dependency>
Gradle
compile "pw.kmp:kodeinject:1.2.2"
Injected
class Application(db: Database) {
// stuff goes here
}
val kodein = Kodein {
bind<Database>() with singleton { MongoDB("127.0.0.1", 27017) }
bind() from injected<Application>()
}
kodeinject
will automatically instantiate your injected()
classes using
bindings from the Kodein container.
Singleton
val kodein = Kodein {
bind() from injectedSingleton<Application>()
}
Use injectedSingleton()
to cache the dependency instead of creating a new
instance for each access.
Nullable
class Application(db: Database, cache: Cache?) {
// stuff goes here
}
Paramaters that are nullable will be set to null if they are unavailable upon injection.
Automatic Kodein injection
class Application(kodein: Kodein) {
// stuff goes here
}
Constructors requiring the Kodein
object will be injected with it by default, without the need to create a binding.