I can't inject my class with koin when using ktor in development mode. (2.0.0-beta-1)
Copy code
routing {
val service by KoinJavaComponent.inject<PageService>(PageService::class.java)
...
Exception:
Copy code
class com.xyz.PageService cannot be cast to class com.xyz.PageService (com.xyz.PageService is in unnamed module of loader 'app'; com.xyz.PageService is in unnamed module of loader io.ktor.server.engine.OverridingClassLoader$ChildURLClassLoader @55a88417)
Also it's injected fine at app startup, but fails with this exception when it's done in the
routing
lambda. Works fine when I disable development mode, too. Any ideas?
Thank you, to be honest I didn't even know I needed to install the ktor plugin at all, but it's indeed noted in the docs that it's required for the autoreload to work: https://insert-koin.io/docs/reference/koin-ktor/ktor/