package com.in.trigger.config; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder; import java.text.SimpleDateFormat; import java.util.TimeZone; /** * Jackson配置类 */ @Configuration public class JacksonConfig { /** * 配置ObjectMapper */ @Bean public ObjectMapper objectMapper() { return Jackson2ObjectMapperBuilder.json() .featuresToDisable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) .featuresToEnable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY) .dateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")) .timeZone(TimeZone.getDefault()) .build(); } }