springmvc时间(date)无法转入后台(@DateTimeFormat+@JsonFormat(GMT+8))

spring时间(date)无法转入后台

Type Status Report

Description The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).

解决方案:

方案一:

 如果用实体类接收参数,则在Date属性上边加@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")

 方案二:

接收参数前边加一个@DateTimeFormat(pattern = "yyyy-MM-dd")

 当是json时候,使用@JsonFormat(pattern = "yyyy-MM-dd",timezone="GMT+8")

 


posted @ 2018-11-04 05:13  韦邦杠  阅读(1034)  评论(0编辑  收藏  举报