How it works
When you use@JaversSpringDataAuditable on a Spring Data repository, Javers inserts a snapshot document into the jv_snapshots collection every time an entity is saved or deleted. FlowWarden Javers watches this collection via MongoDB Change Streams and delivers events to your handler:
Setup
1. Add dependencies
2. Audit your repository
3. Create a Javers stream handler
Javers snapshot types
Javers defines three snapshot types that map to FlowWarden handler annotations:Handler signatures
Each handler annotation supports three signature styles:JaversChangeContext
TheJaversChangeContext<T> gives you access to both Javers audit data and FlowWarden event metadata:
Javers data
FlowWarden data
FlowWarden annotations
All standard FlowWarden annotations work on@JaversStream classes:
@Pipeline also works and is applied in addition to the automatic entity type filter. Use it for extra server-side filtering (e.g., filtering by specific changedProperties or commitMetadata.author).Snapshot collection configuration
The Javers snapshot collection name is resolved in order:- Explicit:
@JaversStream(snapshotCollection = "custom_snapshots") - Javers property:
javers.snapshotCollectionNamefromapplication.yml - Default:
jv_snapshots
Entity deserialization
FlowWarden deserializes the Javersstate field into your domain object using Spring Data MongoDB’s MongoConverter. This means:
- Standard Spring Data annotations (
@Field,@Id, etc.) are respected - Custom converters registered with Spring are used
- For
@OnTerminalevents, the entity represents the last known state before deletion
Source on GitHub
Browse the
flowwarden-javers source, issues, and releases.