Hi,
I’m new to axon, and I’m trying to understand the two different way of storing aggregate state,
-
the standard jpa repository to persist the state
-
the event sourcing repository to persist the event and get the state by replaying the events
The question is how can I make the binding of jpa repository with my aggregate?
I tried to make a configure class with @Configuration and @EnableAxon annotation, and write the below codes
@Bean
public EntityManagerProvider entityManagerProvider() {
return new ContainerManagedEntityManagerProvider();
}
@Bean
public Repository<BankAccount> repository(){
return new GenericJpaRepository<BankAccount>(entityManagerProvider(),BankAccount.class, eventBus());
}
@Bean
public AggregateConfigurer configurer(){
return AggregateConfigurer.jpaMappedConfiguration(BankAccount.class, entityManagerProvider());
}
But I still getting the error saying no repository specified to my aggregate.
09:51:57.592 [main] ERROR o.s.boot.SpringApplication - Application startup failed org.springframework.context.ApplicationContextException: Failed to start bean 'org.axonframework.spring.config.AxonConfiguration'; nested exception is java.lang.IllegalStateException: Default configuration requires the use of event sourcing. Either configure an Event Store to use, or configure a specific repository implementation for class com.edi.learn.axon.aggregates.BankAccount