I m planning to migrate from ktor to spring boot ,...
# spring
a
I m planning to migrate from ktor to spring boot , I am simply unable to figure out how to get ktor running on Google app engine properly and there seems to be a lack of community support for ktor, a simple rest api. Whats your take on kotlin's 1st class support on spring boot and support for coroutines
c
lol, I’m doing the opposite - too many years of wrestling with bloat of Spring Boot. It can do Kotlin to a limited degree - ontop of WebFlux (Reactive Streams) - challenging to truly untangle everything to have a full Kotlin/coroutine experience.
You can, of course, just use Kotlin in place of Java and continue with all the SB annotation incantations, etc - that will work, to the degree you’re happy with that. Or use the new functional endpoints, they are much simpler. It’s getting full coroutine support that is challenging - doable in some spots, other need to use Rx, etc.
j
Kotlin is a first class citizen on spring boot. Especially if you're using webflux. Coroutines makes webflux much easier
c
Wouldn’t say its a first class citizen. Yes, you can create say suspending functional endpoints - that’s excellent; but as soon as you need to get into filters, Spring Security, request context, etc it’s an awkward mix of Rx code.
j
https://docs.spring.io/spring-framework/reference/languages/kotlin.html
The Spring Framework provides first-class support for Kotlin and lets developers write Kotlin applications almost as if the Spring Framework was a native Kotlin framework. Most of the code samples of the reference documentation are provided in Kotlin in addition to Java.
c
Yes, have read the marketing speak - it doesn’t hold true under extensive real-world use.
It’s Spring trying to play all the bases, creating the image they support everything under the sun - XML bean configuration, annotation bean configuration, anemic functional bean registration, Spring MVC/Servlet, Spring WebFlux, and now another variant for Loom. Once you boil away all the cruft most things can be readily done with Ktor/Koin or similar.
j
Disagree. Ktor and Koin are missing a lot of key features from spring boot. For example, neither provide any support for working with databases
c
So add in the pieces you need for database connectivity - likely more efficient and maintainable than a invasive framework throughout the code.
d
You might want to wait until Spring Boot 3.2 which has support for virtual threads and might simplify your code also with Kotlin.
👍 1
268 Views