Open lexa-diky opened 11 months ago
Can second this, but I would prefer a simple dependency upgrade instead of separate artifact
The workaround for now is to copy everything from the koin Ktor sources and fix the compile time error
If koin goes with single module approach, it will break comp with ktor-2, and I guess bunch of people will not update for a while
The only updates for the past months have been dependency updates... The whole library is 2 files
Yes, great topic coming 👍
Can you please add ktor 3.0 support first before you refactor, add new stuff, and break something with the update you described in your article? @arnaudgiuliani
Changing one line of code, that is, so that we don't wait till Q4 2024 for this to get fixed
something I can setup for 3.6.0 - Q1 Seems that we need to separate both ktor & ktor3
Is there any solution now?
@arnaudgiuliani I would appreciate a solution for this, as I am currently unable to use SSE (server sent events) in my application due to it only being supported in Ktor 3.0.0. Let me know if I can speed up the work, maybe by making a PR?
I'm am interested in this as well and will be watching for updates.
@fluxxion82 Just copy all sources of the Ktor module to your project. This hasn't been addressed in almost a year and the author has no intention of doing so.
it would be nice to get support for this
Still waiting for this. No solutions of as of yet?
Like I said, just copy and paste all sources of Koin-ktor module into your project and fix the breaking changes. Already using this approach in prod
Like I said, just copy and paste all sources of Koin-ktor module into your project and fix the breaking changes. Already using this approach in prod
Pardon but can you please briefly describe what do you mean by this? Earlier we were using koin as:
install(Koin) {
slf4jLogger()
modules(appModule)
}
How do i migrate from this?
Like I said, just copy and paste all sources of Koin-ktor module into your project and fix the breaking changes. Already using this approach in prod
Pardon but can you please briefly describe what do you mean by this? Earlier we were using koin as:
install(Koin) { slf4jLogger() modules(appModule) }
How do i migrate from this?
Figured it out, basically
Warning: This is a workaround, with this:
Yeah this is now broken on ktor 3.x:
java.lang.IncompatibleClassChangeError: Found interface io.ktor.server.routing.Routing, but class was expected
at org.koin.ktor.ext.RoutingExtKt.getKoin(RoutingExt.kt:74)
Will need a ktor3 package, really the impl is basically the same, but they are incompatible due to changes to classes in ktor3
PR here: https://github.com/InsertKoinIO/koin/pull/1978
There is jar with the ktor3 target if you need it for now
@arnaudgiuliani if no objections, can we fast track to 4.0? Happy to maintain the module if you ping me. (And get in the next RC?)
Ktor 3.0.0 has been released yesterday -- https://github.com/ktorio/ktor/releases/tag/3.0.0
It would be lovely if Koin supported it officially ❤️
I could open track for 4.1 in beta version, to play with this yes 👍 4.0 is in maintenance mode (no more features).
Would really appreciate 🫶
I could open track for 4.1 in beta version, to play with this yes 👍 4.0 is in maintenance mode (no more features).
That would be a huge help!
@arnaudgiuliani can you by any chance give an estimated date when such a Beta version with Ktor 3.0.0 support will be testable for us? I'm really looking forward to it
Bumping this. I tried using kodeine also instead of koin to see if the support was there and I ran into the same error mentioned above.
java.lang.IncompatibleClassChangeError: Found interface io.ktor.server.routing.Routing, but class was expected
Bumping this. I tried using kodeine also instead of koin to see if the support was there and I ran into the same error mentioned above.
java.lang.IncompatibleClassChangeError: Found interface io.ktor.server.routing.Routing, but class was expected
If you try to inject outside of routing in Application
scope, it might work.
Bumping this. I tried using kodeine also instead of koin to see if the support was there and I ran into the same error mentioned above.
java.lang.IncompatibleClassChangeError: Found interface io.ktor.server.routing.Routing, but class was expected
If you try to inject outside of routing in
Application
scope, it might work.
@jsixface That actually worked for me! My update was to move the controller injection code out of the routing block. Thank you for the suggestion!
fun Application.configureRouting() {
val fooController by inject<FooController>()
routing {
route("/foo") {
get {
// ...
}
}
}
}
this was the incorrect code I had before
fun Application.configureRouting() {
routing {
route("/foo") {
get {
val fooController by inject<FooController>()
// ...
}
}
}
}
You're welcome. Well, your code was not wrong in the first place. It's just that the KTOR 3.0 has some breaking changes and Koin 4.0 hasn't caught up with it.
Damn, I had just changed all my "controller" files from Application
extensions to Routing
extensions :(
ooph, open for almost a year 😟 has there been any progress on this?
Any work arounds?
I posted a jar you can use, also it's super easy to just copy the plugin code and point at ktor3, there are really only 2 like changes. But yeah I have an open PR to merge in workings, dunno if @arnaudgiuliani needs me to do anything?
Any update on the fix?
Is your feature request related to a problem? Please describe. JB recently released Ktor 3.0.0-betta1. Currently Ktor does not support it, JB changed API. In particular access to monitor now done via
Application
notEnvironment
, maybe there is more incompatibilities.Describe the solution you'd like Separate
ktor-3
module to have both ktor 2. and 3.Target Koin project ktor