//实体模型定义
@Builder.Default
@LastModifiedDate
@Field(type = FieldType.Date, name = "modified_dt", format = DateFormat.basic_date_time)
private Instant modifiedDate = Instant.now();//更新属性调用
protected void updateAttribute(String id, Document document) throws Exception {
UpdateQuery updateQuery = UpdateQuery.builder(id).withDocument(document).build();
UpdateResponse updateResponse = operations.update(updateQuery, indexCoordinates());
Result result = updateResponse.getResult();
if (!result.equals(Result.UPDATED)) {
throw new Exception();
}
}发布于 2021-06-04 22:39:47
从版本7开始,日期格式有所不同,因为yyyy已被uuuu替换,可能与此有关:
另外,Lombok注解@Builder.Default不适用于无参数构造函数,因此它可能也会造成干扰。
https://stackoverflow.com/questions/67672305
复制相似问题