springboot 设置时区
修改application.yml
spring.datasource.url: jdbc:mysql://dev50:3306/ci?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai&useLegacyDatetimeCode=false
spring.jackson.time-zone: Asia/Shanghai
设置entity的返回格式
@CreatedDate
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss"
private Date createTime;
entity 获取创建时间和修改时间
在entity类中增加@EntityListeners(AuditingEntityListener.class)
在configuration类增加@EnableJpaAuditing