SpringBoot中jackson日期格式化问题
最近进行项目迁移工作,由SpringMVC迁移到springboot,中间遇到一个问题就是日期的格式化问题,在MVC环境中显示正常,到了springboot中就由2019-03-06 06:14:32 变成了 2019-03-06T06:14:32.005+0000,经查是由于Jackson未在springboot环境中配置对应的日期格式导致,解决方案如下:
#日期格式化
spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
spring.jackson.time-zone=GMT+8
spring.jackson.serialization.write-dates-as-timestamps=false