com.bybutter.sisyphus.starter.jackson.cbor.Jackson2CborCodecCustomizer.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sisyphus-jackson-starter Show documentation
Show all versions of sisyphus-jackson-starter Show documentation
Starter for configuring HttpMessageEncoder with Jackson in Sisyphus Framework
package com.bybutter.sisyphus.starter.jackson.cbor
import com.bybutter.sisyphus.jackson.Cbor
import org.springframework.boot.web.codec.CodecCustomizer
import org.springframework.http.MediaType
import org.springframework.http.codec.CodecConfigurer
import org.springframework.http.codec.DecoderHttpMessageReader
import org.springframework.http.codec.EncoderHttpMessageWriter
import org.springframework.http.codec.cbor.Jackson2CborDecoder
import org.springframework.http.codec.cbor.Jackson2CborEncoder
class Jackson2CborCodecCustomizer : CodecCustomizer {
override fun customize(configurer: CodecConfigurer) {
configurer.customCodecs().register(EncoderHttpMessageWriter(Jackson2CborEncoder(Cbor.mapper, MediaType.APPLICATION_CBOR)))
configurer.customCodecs().register(DecoderHttpMessageReader(Jackson2CborDecoder(Cbor.mapper, MediaType.APPLICATION_CBOR)))
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy