InsertKoinIO / koin

Koin - a pragmatic lightweight dependency injection framework for Kotlin & Kotlin Multiplatform
https://insert-koin.io
Apache License 2.0
9.1k stars 720 forks source link

Koin is not compatible with Ktor 3.0.0 #2027

Closed AlejandroYuste closed 1 month ago

AlejandroYuste commented 1 month ago

Describe the bug If the injection is defined as part of a route it will not find the class.

To Reproduce Define something like:

fun Route.account() {
    route("/account") {
        val fetchAccountUseCase by inject<FetchAccountUseCase>()

        get {
            // whatever
         }
    }
}

java.lang.NoClassDefFoundError: io/ktor/server/routing/RoutingKt at org.koin.ktor.ext.RouteExtKt.getKoin(RouteExt.kt:74) at app.presentation.account.AccountKt$account$$inlined$inject$default$1.invoke(RouteExt.kt:76)

Expected behavior Everything should run smoothly.

Koin module and version: koin-core:4.0.0 ktor:3.0.0

valeriyo commented 1 month ago

Duplicate of https://github.com/InsertKoinIO/koin/issues/1716

sschuberth commented 1 month ago

Duplicate of #1716

Indeed, please close this issue @AlejandroYuste.