I tried to set up SpringPrototypeAggregateFactory in my spring config but I did not find where and how to do so. I assume it has to be done in axon:event-sourcing-repository - but there’s no config option for this. I googled a lot but did not find a solution.
If I recall correctly (can’t check right now), there is an attribute that allows you to specify an AggregateFactory. That should refer to a bean of type SpringPrototype…Factory. That factory then refers to another bean, which must have scope prototype.
Yes, the command-handler definition is completely unrelated to how the aggregates are constructed. It just registers command handlers defined on an aggregate type with the command bus.