package org.nstart.dep265.requestservice.config

import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration

@Configuration
class JacksonConfig {
    /**
     * The service code still depends on Jackson 2 APIs, while the shared Boot 4 stack
     * auto-configures Jackson 3 for MVC. Keep a dedicated Jackson 2 mapper for internal
     * parsing until the module is migrated.
     */
    @Bean
    fun objectMapper(): ObjectMapper {
        return jacksonObjectMapper()
            .registerModule(JavaTimeModule())
            .findAndRegisterModules()
    }
}
