一、在实体的属性上加注解@JsonFormat @ApiModelProperty("创建时间") @Column("CJSJ") @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private Date createTime;
二、application.properties加全局配置
#全局格式化时间 spring.jackson.date-format=yyyy-MM-dd HH:mm:ss spring.jackson.time-zone=GMT+08