Hey there,
Up until now, I haven’t had any problems with stuff injected from Spring’s context into my aggregate.
However, in the following scenario dependencies are not injected yet. Looks like maybe the Spring Aggregate Factory is not being used to instantiate the Aggregate in that scenario?
`
class MyAggregate {
@Autowired
private MyService myService;
@CommandHandler
constructor(MyCommand command) {
AggregateLifecycle.apply(new CreatedEvent(…))
}
@EventSourcingHandler
private void onEvent(CreatedEvent event) {
// myService here is null
}
}
`
Any suggestions on best practises?