I’m using the SpringPrototypeEventSourcingRepository for the first time and cannot track down why aggregates that are loaded from snapshot events don’t get their dependencies injected. I’m still using Axon 1.1 (and cannot migrate for the time being).
SpringPrototypeEventSourcingRepository is an AggregateFactory itself in 1.1 that loads the aggregate prototype from the application context. If the aggregate is loaded solely with simple domain events, everything works as expected, but as soon as the trigger creates a snapshot, the repository does not use the AggregateFactory, only the snapshot (see method createAggregate(identifier, firstEvent) in EventSourcingRepository). Dependencies don’t get injected resulting in nasty NPEs.
Any help would be appreciated, or do I simply miss something?