'Spring boot 2.6.4 all my variables of type date and localtime gives only number without format
My spring boot project has a problem, I updated from version 2.5.1 to 2.6.4 and now all my variables of type date and localtime are given number without format
examples :
date = "2022-03-04" in JSON are "1646352000000"
and my localtime are like this :
localtime = "09:00:00" in JSON is "9"
any suggestions on how to fix it ?
Solution 1:[1]
You should configure Jackson in order to avoid serialization of Java dates in timestamp.
You should add
dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<version>2.9.5</version>
and configure it like this
ObjectMapper mapper = new ObjectMapper(); mapper.registerModule(new JavaTimeModule());
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | sixrandanes |
