I've a LocalDateTime field with @JsonFormat
@JsonFormat(pattern = "yyyy-MM-dd'T'hh:mm:ss.SSS'Z'")
private LocalDateTime dateTime;
When Jackson try to parse a date like 2018-11-28T15:24:00.000Z a exception is throwed
com.fasterxml.jackson.databind.JsonMappingException: Can not construct instance of java.time.LocalDateTime: no String-argument constructor/factory method to deserialize from String value ('2018-11-28T15:24:00.000Z')
In my pom.xml i have:
- Spring boot 1.5.7
- jackson-datatype-jdk8
- jackson-datatype-jsr310
My ObjectMapper Bean:
@Bean
public ObjectMapper postConstruct() {
return this.builder
.featuresToDisable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
.defaultUseWrapper(false)
.build();
}
I also tried:
@JsonFormat(pattern = "yyyy-MM-dd'T'hh:mm:ss.SSS'Z'", timezone ="UTC")
private LocalDateTime dateTime;