Hey, I have published my <Next level Kotlin suppor...
# spring
s
👍 8
K 7
🎉 4
👍🏾 1
❤️ 1
r
What does
spring-boot-starter-kotlinx-serialization-json
module do?
s
Register Kotlin Serialization JSON autoconfiguration and brings related dependencies. Spring Boot 4 has a modular design now, if you don’t use that it will not be autoconfigured. See that as a stronger signal than just presence in the classpath of Kotlin Ser.
r
So what is used when this starter module is not present?
s
Jackson typically
If Jackson module/starter is present
Which is the case by default with the webmvc starter.
r
So do I understand correctly - in Spring Boot 3, when kotlinx.serialization was on the classpath it was used for serialization of Kotlin classes with
@Serializable
annotations. After migration to Spring Boot 4 it's no longer used, unless I add this new starter module?
s
Yep
r
Thank you. I need to read migration guides more carefully 🙂
s
I highly recommend reading https://spring.io/blog/2025/10/28/modularizing-spring-boot carefuly, very important.
👍 1
k
> With Spring Boot 4.0, when both Kotlin Serialization and Jackson are used, the latter will handle only types annotated with
@Serializable
at root or generic type level (see related utility method) latter or former?
s
Good catch, former, I changed the order and forgot to update, updating it right now.
👍 1
s
I added the dependency to my project today and configured
spring.kotlinx.serialization.json.naming-strategy: SNAKE_CASE
. Created a post mapping with a
@Serializable
data class as request body. However, requests would work only if I sent them as kebab case. I read the documentation once again and I was wondering if the dependency is all about having a
Json
bean or it can be a drop in replacement for jackson as request body deserializers