import com.fasterxml.jackson.annotation.JsonFormat;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private LocalDateTime createTime;
import com.fasterxml.jackson.annotation.JsonFormat;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private LocalDateTime createTime;
如果是1.x springboot,jackson对jdk8的时间类默认不支持,要导 jsr310 包,自定义 objectmapper,配置上 objectMapper.registerModule(new JavaTimeModule())