com.bybutter.sisyphus.starter.jackson.yaml.Jackson2YamlCodecCustomizer.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.yaml
import com.bybutter.sisyphus.jackson.Yaml
import org.springframework.boot.web.codec.CodecCustomizer
import org.springframework.http.codec.CodecConfigurer
import org.springframework.util.MimeType
class Jackson2YamlCodecCustomizer : CodecCustomizer {
companion object {
val DEFAULT_YAML_MIME_TYPES = arrayOf(
MimeType("text", "vnd.yaml"),
MimeType("text", "yaml"),
MimeType("text", "x-yaml"),
MimeType("text", "*+x-yaml"),
MimeType("application", "yaml"),
MimeType("application", "x-yaml"),
MimeType("application", "*+x-yaml")
)
}
override fun customize(configurer: CodecConfigurer) {
configurer.customCodecs().register(Jackson2YamlEncoder(Yaml.mapper, *DEFAULT_YAML_MIME_TYPES))
configurer.customCodecs().register(Jackson2YamlDecoder(Yaml.mapper, *DEFAULT_YAML_MIME_TYPES))
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy