public class SpringAggregateSnapshotter
extends org.axonframework.eventsourcing.AggregateSnapshotter
implements org.springframework.context.ApplicationContextAware
AggregateSnapshotter, this implementation lazily retrieves AggregateFactories from the Application
Context when snapshot requests are made.
Instead of configuring directly, consider using the SpringAggregateSnapshotterFactoryBean, which
configures this class using values available in the application context.
SpringAggregateSnapshotterFactoryBean| Modifier and Type | Class and Description |
|---|---|
static class |
SpringAggregateSnapshotter.Builder
Builder class to instantiate a
SpringAggregateSnapshotter. |
| Modifier | Constructor and Description |
|---|---|
protected |
SpringAggregateSnapshotter(SpringAggregateSnapshotter.Builder builder)
Instantiate a
SpringAggregateSnapshotter based on the fields contained in the SpringAggregateSnapshotter.Builder. |
| Modifier and Type | Method and Description |
|---|---|
static SpringAggregateSnapshotter.Builder |
builder()
Instantiate a Builder to be able to create a
SpringAggregateSnapshotter. |
protected org.axonframework.eventsourcing.AggregateFactory<?> |
getAggregateFactory(Class<?> aggregateType) |
void |
setApplicationContext(org.springframework.context.ApplicationContext applicationContext) |
createSnapshot, registerAggregateFactoryprotected SpringAggregateSnapshotter(SpringAggregateSnapshotter.Builder builder)
SpringAggregateSnapshotter based on the fields contained in the SpringAggregateSnapshotter.Builder. The
AggregateFactory instances are lazily retrieved by the ApplicationContext.
Will assert that the EventStore, ParameterResolverFactory and HandlerDefinition are not
null, and will throw an AxonConfigurationException if any of them is null.
builder - the SpringAggregateSnapshotter.Builder used to instantiate a SpringAggregateSnapshotter instancepublic static SpringAggregateSnapshotter.Builder builder()
SpringAggregateSnapshotter. The AggregateFactory
instances are lazily retrieved by the ApplicationContext.
The Executor is defaulted to an DirectExecutor.INSTANCE and the
TransactionManager defaults to a NoTransactionManager.
Additionally, this Builder has convenience functions to default the ParameterResolverFactory and
HandlerDefinition based on instances of these available on the classpath in case these are not provided
(respectively AggregateSnapshotter.Builder.buildParameterResolverFactory() and AggregateSnapshotter.Builder.buildHandlerDefinition()).
Upon instantiation of a AggregateSnapshotter, it is recommended to use these function to set those
fields.
The EventStore is a hard requirement and as such should be provided.
SpringAggregateSnapshotterClasspathParameterResolverFactory,
ClasspathHandlerDefinitionprotected org.axonframework.eventsourcing.AggregateFactory<?> getAggregateFactory(Class<?> aggregateType)
getAggregateFactory in class org.axonframework.eventsourcing.AggregateSnapshotterpublic void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
throws org.springframework.beans.BeansException
setApplicationContext in interface org.springframework.context.ApplicationContextAwareorg.springframework.beans.BeansExceptionCopyright © 2010–2022. All rights reserved.