gpt4 book ai didi

spring-data-rest - 支持只读属性

转载 作者:行者123 更新时间:2023-12-04 12:51:36 25 4
gpt4 key购买 nike

我们的存储库实体具有审计/日志属性,如(createdDate、updatedDate...),这些属性由应用程序分配,并且应该是用户的只读属性。对 Jackson showed this feature is not supported 的一点研究(或者是吗?)。想知道 SDR 在这里是否有帮助?

更新 1:添加实体以获取详细信息:

@Document(collection="employees")
public class Employee {

@Id
private String id;
private firstName;
private lastName;

//read-only attribute. initially assigned by application and should not be changed
private Date createdDate;

//read-only attribute. initially assigned by application and should not be changed
private Employee createdBy;

//getters setters truncated....
}

最佳答案

org.springframework.data.annotation.ReadOnlyProperty 是在 spring-data-commons 1.9.0 中添加的。

这达到了目的。请引用:

  • https://jira.spring.io/browse/DATACMNS-534
  • https://github.com/spring-projects/spring-data-commons/pull/88
  • 关于spring-data-rest - 支持只读属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25900194/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com