本文介紹了 Javers,一個開源 Java 程式庫,支援對 Java 應用程式中的實體進行全面、臨時的審核和版本控制。它簡化了對物件變更的跟踪,提供歷史版本和對資料的洞察
要使用Javers 進行實體更改跟踪,請按照以下步驟操作:
<dependency> <groupId>com.googlecode.javers</groupId> <artifactId>javers-core</artifactId> <version>6.2.3</version> </dependency>
Javers javers = JaversBuilder.javers().build();
javers.register(Author.class); javers.register(Book.class);
Book book = new Book("The Hitchhiker's Guide to the Galaxy", "Douglas Adams"); Entity audit = javers.commit("default", book);
book.setName("The Restaurant at the End of the Universe"); javers.commit("default", book);
List<Change> changes = javers.findChanges(JaversQuery.byInstance(book).build());
javers-persistence
javers-mongo
JPA:javers-neo4j
MongoDB:以上是javers使用教學課程的詳細內容。更多資訊請關注PHP中文網其他相關文章!