Ktor with Koin
By default the Ktor module uses Guice for dependency injection. You can use Koin instead by using kvision-server-ktor-koin
module.
Koin doesn't support any implicit or just-in-time bindings. All components need to be declared inside modules using Koin DSL. You need to pass all your modules to the kvisionInit()
function.
KVision works best with constructor DSL from Koin 3.2. You should use factoryOf()
binding function for all components that need access to the Ktor's ApplicationCall
instance and use constructor parameter injection.
You can use lazy evaluated injection or other scopes (e.g. single) for services that do not need to work with ApplicationCall
.
Last updated