【问题标题】:Javers - How to avoid/disable perticular field for the auditing by Javers?Javers - 如何避免/禁用 Javers 审计的特定字段?
【发布时间】:2019-11-08 07:44:03
【问题描述】:

我正在使用 Spring Boot Javers 集成 示例,参考 https://javers.org/documentation/spring-boot-integration/https://github.com/javers/organization-structure.git

我已经开发了可以正常工作的完全工作的 POC,但是像 CreatedDateCreatedBylastUpdateDateLastUpdatedBy 这些字段我已经使用 Spring @EnableMongoAuditing 功能进行了审计。但我不想考虑这些字段供 Javers 审核。

是否可以跳过审核/更改字段?

【问题讨论】:

    标签: javers


    【解决方案1】:

    这里有很好的文档:https://javers.org/documentation/domain-configuration/#ignoring-things

    使用属性级

    @DiffIgnore@ShallowReference 忽略不重要的属性。或者,使用@DiffInclude 标记所有重要属性。请参阅属性注释。

    使用类级

    @DiffIgnore@ShallowReference@IgnoreDeclaredProperties(参见类注解)。

    @DiffIgnore 最强,意味着我不在乎,只需忽略所有此类对象。

    @ShallowReference 是中等的,意思是做浅差异,只有当引用的 Id 改变时才打扰我。

    @IgnoreDeclaredProperties 是最不激进的,意味着忽略在此类中声明的所有属性,但要注意所有继承的属性。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-07-25
      • 2016-12-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-02-18
      相关资源
      最近更新 更多