问题: 前端接收到的时间格式不标准。
方案1.实体类添加注解
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;//创建时间
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;//更新时间
方案2.application.yaml中配置,全体生效
spring:
jackson:
date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8
serialization:
#格式化输出
indent_output: true
#忽略无法转换的对象
fail_on_empty_beans: false