The date is one day less when Jackson returns JSON
After testing, it is found that when an object is converted to JSON, the value returned by the date type is always 1 less than the value in the database.
For example, if the date of the database is 2017-12-12, it will become 2017-12-1 when it is transferred to JSON. Solution 1:
Use @ JsonFormat (pattern= "yyyy-MM-dd", timezone= "GMT+8") br/ > solution 1 in the get method of the object POJO:
Use @ JsonFormat (pattern= "yyyy-MM-dd", timezone= "GMT+8") in the get method of the object POJO
/ * timeZone= "GMT+8" plus time zone * /
@ JsonFormat (pattern = "yyyy-MM-dd", timezone= "GMT+8")
Public Date getShenqrq () {
Return shenqrq
}
Public void setShenqrq (Date shenqrq) {
This.shenqrq = shenqrq
}
Solution 2:
NON_NULL