Hello,
after the M5 release, I tried to migrate to @EnableAxon to get rid of the majority of the manual configuration.
I stumbled across the following issues:
When trying to:
@Autowire Repository<SomeAggregate> repository;
It is not available. What I understood is, that it would be made available automatically. How would I inject it ?
When I add a manual configuration:
`
@Bean
public Repository agentEventSourcingRepository() {
return new EventSourcingRepository<>(new SomeAggregateAggregateFactory(), eventStore);
}
`
The above injection works just fine.
However, even though, I can now inject the repository into a command handler service, it appears to forget the AggregateFactory I have wired in in the above configuration.
What I have is a class hierarchy for implementing the Aggregate, and I have a command handler for creating the different sub-classes depending on the creation command. And thus, I also need the Aggregate factory for recreating the aggregates.
What is the recommended way to wire this up using the @EnableAxon feature ?
And how do I inject the repository when not defining it manually ?
My manual configuration from M4 works just fine with M5
Thank you.
Best regatds,
Dominic