Snapshotting in axon 4.2

How do you properly configure snapshots for Aggregates to occur after 3 events in Axon 4.2, using the most basic out-of-the-box setup?

We’ve read countless posts and the Axon documentation over and over. The tables are created and nothing is being written. Most of the time, we get Spring issues when starting the app. Here’s the gist of what’s been done.

  1. Followed a simple example of Axon. Great tutorial to get started for those familiar with the ES concepts, and looking for a quick start.

  2. Enabled JDBC persistence by exclude a dependency in the pom, added sqlserver driver, and properly configured Regular events are persisted as expected.

  3. We added annotation to the Aggregate to define the trigger

@Aggregate(snapshotTriggerDefinition = "mySnapshotTriggerDefinition") public class OrderAggregate {

and created a config class with what we believe to be the basics according to the documentation.

import org.axonframework.eventsourcing.EventCountSnapshotTriggerDefinition;
import org.axonframework.eventsourcing.SnapshotTriggerDefinition;
import org.axonframework.eventsourcing.Snapshotter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

public class AxonConfig {

public SnapshotTriggerDefinition mySnapshotTriggerDefinition(Snapshotter snapshotter) {
return new EventCountSnapshotTriggerDefinition(snapshotter, 3);

and we see the message of:


Hello Jerry,
I looked for references to Snapshotter and found this definition in org.axonframework.springboot.autoconfig.AxonAutoConfiguration. So, I guess the question is, do you have an EventStore bean defined? Also, you’re using Spring Boot, right?


public SpringAggregateSnapshotter aggregateSnapshotter(Configuration configuration,
HandlerDefinition handlerDefinition,
ParameterResolverFactory parameterResolverFactory,
EventStore eventStore,
TransactionManager transactionManager) {
return SpringAggregateSnapshotter.builder()


Thanks for the reply Brian. After reviewing everything again, we discovered that we are actually running Axon 4.1.2 and not 4.2.1 like we thought. We did have the Axon Server running using 4.2 which was a point of confusion. After moving the framework to the latest Maven artifacts, bam, it worked with the minimal setup from my original post.

Now I see snapshots being persisted in SQL Server as expected. Sweet! That is really powerful and easy to setup.

One final question, how can I confirm that the snapshots are being used to recreate the Aggregates? With minimal configuration, I was able to persist to a DB and generate snapshots, so my assumption is the framework is smart enough to use them if they exist. It’s not good to assume so I’d like to verify what’s going on.


Hi Jerry,

One final question, how can I confirm that the snapshots are being used to recreate the Aggregates?

Quickest approach would be to have snapshotting enabled locally and place either log messages or debug pointers in your event sourcing handlers.

Without snapshotting, the pointers/log-statements would be hit for every event in an Aggregate’s event stream.

With snapshotting, you will notice that this is not the case.