package com.xiaopeng.common.security.config; import java.util.TimeZone; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; /** * 系统配置 * * @author ruoyi */ @EnableConfigurationProperties(TokenProperties.class) public class ApplicationConfig { /** * 时区配置 */ @Bean public Jackson2ObjectMapperBuilderCustomizer jacksonObjectMapperCustomization() { return jacksonObjectMapperBuilder -> jacksonObjectMapperBuilder.timeZone(TimeZone.getDefault()); } /** * 序列化配置 * @return */ @Bean public Jackson2ObjectMapperBuilderCustomizer jackson2ObjectMapperBuilderCustomizer() { return builder -> { // Long 会自动转换成 String builder.serializerByType(Long.class, ToStringSerializer.instance); }; } }