Koject
Koject is a DI Container Library for Kolin Multiplatform using KSP.
fun main() {
Koject.start()
val controller = inject<Controller>()
}
@Singleton
@Provides
class Api
@Singleton
@Provides
fun provideDB(): DB {
return DB.create()
}
@Binds
@Singleton
@Provides
class RepositoryImpl(
private val api: Api,
private val db: DB,
): Repository
interface Repository
@Provides
class Controller(
private val repository: Repository
)
Features
- Support Kotlin Multiplatform
- Easy provide with annotations
- Check dependency graph at compile time
- Code generation with KSP
- Support multi-module project
Documents
Examples
Related libraries
Koject is inspired by the following libraries.