-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Closed as not planned
Labels
in: webIssues in web modules (web, webmvc, webflux, websocket)Issues in web modules (web, webmvc, webflux, websocket)status: declinedA suggestion or change that we don't feel we should currently applyA suggestion or change that we don't feel we should currently applytheme: kotlinAn issue related to Kotlin supportAn issue related to Kotlin support
Description
It seems there isn't a way to provide a custom Json or set config on Json for the KotlinSerializationJsonDecoder
Spring Framework 5.3.14
Workaround:
@Configuration(proxyBeanMethods = false)
class InitConfiguration {
@ExperimentalSerializationApi
@Bean
fun kotlinSerializationJsonDecoder() = KotlinSerializationJsonDecoder(Json {
explicitNulls = false
})
}
@ExperimentalSerializationApi
@Configuration
class WebConfig(val decoder: KotlinSerializationJsonDecoder) : WebFluxConfigurer {
override fun configureHttpMessageCodecs(configurer: ServerCodecConfigurer) {
super.configureHttpMessageCodecs(configurer)
configurer.defaultCodecs().kotlinSerializationJsonDecoder(decoder)
}
}albertocavalcante
Metadata
Metadata
Assignees
Labels
in: webIssues in web modules (web, webmvc, webflux, websocket)Issues in web modules (web, webmvc, webflux, websocket)status: declinedA suggestion or change that we don't feel we should currently applyA suggestion or change that we don't feel we should currently applytheme: kotlinAn issue related to Kotlin supportAn issue related to Kotlin support