Hi, is there a way to tell axon what name to use for the repository when creating it. E.g. if I have an aggregate Book, axon will auto create BookRepository. Can I somehow change that to e.g. AxonBookRepository via configuration? Thank you
With the current version a repository will be named by the
AggregateConfigurer and be named something like something like:
Repository<GiftCard>. But that is the Axon component name. For Spring, the name will indeed be
GiftCardRepository in this case.
This is done via the
SpringAggregateLookup. A way around this would be to set the
repository property in the
Aggregate annotation, so something like:
@Aggregate(repository = "axonBookRepository"). However for this to work you will also need to create the
axonBookRepository bean yourself.
thank you for your answer. Yes, I figured out the same that I probably need to create the bean myself. Can you give me a good example how to do this? So far I have found java - Axon Aggregate Identifier Type Converter - Stack Overflow. Is this the recommended way to create custom repositories for all aggregates?
I think it can be simpler. I don’t have an example, but here you can find the code that will create the repository when no repository property is present.