In Spring Boot 1.2.3.RELEASE with fasterxml what is the correct way of serializing and de-serializing a LocalDate field to ISO date formatted string?
I've tried:
spring.jackson.serialization.write-dates-as-timestamps:falsein application.properties file,including jackson-datatype-jsr310 in project and then using
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd")annotationand
@DateTimeFormat(iso=ISO.DATE)annotation,
adding
Jsr310DateTimeFormatAnnotationFormatterFactoryas formatter with:@Override public void addFormatters(FormatterRegistry registry) { registry.addFormatterForFieldAnnotation(new Jsr310DateTimeFormatAnnotationFormatterFactory()); }
None of the above helped.
in build.gradle and then following annotations helped:
Update: if you are using Spring Boot 2.*, the dependency is already included via one of the "starters".