I hope someone can point out what I'm missing here.
I have a Spring Boot 2 App with a rest controller that takes a handful of request parameters, one of them being a java.time.Instant as "@RequestParam("offset") Instant offset,". I expected this to be deserializable from a second or millisecond based timestamp, like 1604303073000.
Yet I always get the mentioned exception, originating at org.springframework.format.datetime.standard.InstantFormatter.parse(InstantFormatter.java:50) ~[spring-context-5.2.2.RELEASE.jar:5.2.2.RELEASE]
The serialization of Instants to second or millisecond based timestamps works just fine with these parameters:
jackson:
serialization:
write-dates-as-timestamps: true
write-date-timestamps-as-nanoseconds: true
deserialization:
read-date-timestamps-as-nanoseconds: false
But the opposite way seems to have no effect at all on the deserialization, no matter if it's set to true or false. Spring obviously just tries to apply my timestamps to the wrong Formatter.
All similar issues I could find seemed to imply that this is a no-brainer and the default behavior, yet this already caused some quite frustrating hours of trial and error.