1.报错信息:
java.time.DateTimeException: Unable to obtain Instant from TemporalAccessor: {},ISO resolved to 2022-02-15T07:28:26.524 of type java.time.format.Parsed
2.实体类:
@ApiModelProperty(notes = "创建时间", required = true)
@TableField(value = "create_time")
@Field(type = FieldType.Date, format = DateFormat.date_hour_minute_second_millis, pattern = "yyyy-MM-dd HH:mm:ss:SSS")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss:SSS")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss:SSS", shape = JsonFormat.Shape.STRING, timezone = "GMT+8")
private Date createTime;
3.ES依赖坐标:
<!-- ES -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-elasticsearch</artifactId>
<version>2.3.2.RELEASE</version>
</dependency>
4.解决办法:更换ES依赖坐标为:
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-elasticsearch</artifactId>
<version>4.2.0</version>
</dependency>