fix(json): применять Kotlin-модуль Jackson 3
This commit is contained in:
17
web/src/main/kotlin/ru/ysu/lms/web/config/JacksonConfig.kt
Normal file
17
web/src/main/kotlin/ru/ysu/lms/web/config/JacksonConfig.kt
Normal file
@@ -0,0 +1,17 @@
|
||||
package ru.ysu.lms.web.config
|
||||
|
||||
import org.springframework.boot.jackson.autoconfigure.JsonMapperBuilderCustomizer
|
||||
import org.springframework.context.annotation.Bean
|
||||
import org.springframework.context.annotation.Configuration
|
||||
import tools.jackson.module.kotlin.KotlinModule
|
||||
|
||||
/** Jackson 3: без Kotlin-модуля DTO с default-значениями требуют все поля JSON. */
|
||||
@Configuration
|
||||
class JacksonConfig {
|
||||
@Bean
|
||||
fun kotlinModule(): KotlinModule = KotlinModule.Builder().build()
|
||||
|
||||
@Bean
|
||||
fun kotlinJsonCustomizer(): JsonMapperBuilderCustomizer =
|
||||
JsonMapperBuilderCustomizer { builder -> builder.addModule(KotlinModule.Builder().build()) }
|
||||
}
|
||||
Reference in New Issue
Block a user