Add kotlinx.serialization JSON support to Spring WebFlux

Flow decoding is not supported yet since it depends on
kotlin/kotlinx.serialization#1073, but it will be
enabled when this issue will be fixed.

Closes gh-25771
This commit is contained in:
Sébastien Deleuze
2020-10-06 23:02:14 +02:00
parent 1cd8871d7f
commit 92b2c45281
9 changed files with 479 additions and 6 deletions

View File

@@ -389,14 +389,14 @@ project for more details.
=== Kotlin multiplatform serialization
As of Spring Framework 5.3, https://github.com/Kotlin/kotlinx.serialization[Kotlin multiplatform serialization] is
supported in Spring MVC. The builtin support currently only targets JSON format.
supported in Spring MVC and Spring WebFlux. The builtin support currently only targets JSON format.
To enable it, follow https://github.com/Kotlin/kotlinx.serialization#setup[those instructions] and make sure neither
Jackson, GSON or JSONB are in the classpath.
NOTE: For a typical Spring Boot web application, that can be achieved by excluding `spring-boot-starter-json` dependency.
If you need Jackson, GSON or JSONB for other purposes, you can keep them on the classpath and
In Spring MVC, if you need Jackson, GSON or JSONB for other purposes, you can keep them on the classpath and
<<web#mvc-config-message-converters, configure message converters>> to remove `MappingJackson2HttpMessageConverter` and add
`KotlinSerializationJsonHttpMessageConverter`.