jackson配置

This commit is contained in:
谭凯凯 2024-11-21 09:59:01 +08:00 committed by Tankaikai
parent 449e36ab4a
commit b74e455f5d
1 changed files with 2 additions and 1 deletions

View File

@ -8,6 +8,7 @@ import org.springframework.http.converter.json.MappingJackson2HttpMessageConvert
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import java.text.SimpleDateFormat;
import java.util.TimeZone;
/**
@ -29,7 +30,7 @@ public class WebConfig implements WebMvcConfigurer {
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
//日期格式转换
//mapper.setDateFormat(new SimpleDateFormat(DateUtils.DATE_TIME_PATTERN));
mapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"));
mapper.setTimeZone(TimeZone.getTimeZone("GMT+8"));
//Long类型转String类型