fix(json): применять Kotlin-модуль Jackson 3
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
package ru.ysu.lms.identity.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-модуль автоматически в Spring Boot 4:
|
||||
* без него 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