Skip to main content
Javers is a popular Java library for auditing and tracking changes to domain objects. FlowWarden Javers connects Javers audit snapshots to FlowWarden’s Change Stream engine, letting you react to audit events in real time with deserialized domain objects and full Javers metadata.

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

The JaversChangeContext<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:
  1. Explicit: @JaversStream(snapshotCollection = "custom_snapshots")
  2. Javers property: javers.snapshotCollectionName from application.yml
  3. Default: jv_snapshots
If you changed the Javers collection name via properties and don’t set snapshotCollection explicitly on @JaversStream, FlowWarden will auto-detect it from the Javers configuration. Make sure the property is set before the application context initializes.

Entity deserialization

FlowWarden deserializes the Javers state 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 @OnTerminal events, the entity represents the last known state before deletion

Source on GitHub

Browse the flowwarden-javers source, issues, and releases.