package com.lanyuanxiaoyao.service.configuration;

import com.fasterxml.jackson.datatype.eclipsecollections.EclipseCollectionsModule;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Jackson 自定义设置
 *
 * @author lanyuanxiaoyao
 * @date 2023-04-21
 */
@Configuration
public class JacksonConfiguration {
    private static final Logger logger = LoggerFactory.getLogger(JacksonConfiguration.class);

    @Bean
    public Jackson2ObjectMapperBuilderCustomizer jackson2ObjectMapperBuilderCustomizer() {
        return builder -> {
            builder.modules(
                    new EclipseCollectionsModule(),
                    new JavaTimeModule()
            );
        };
    }
}
