`
@Aggreagate
class MyFirstAggregate constructor() {
@AggregateIdentifier
private lateinit var id: Id
@CommandHandler
constructor(cmd: CreateMyFirstAggregateCommand) {
}
}
@Aggregate
class MySecondAggregate constructor(){
@AggregateIdentifier
private lateinit var id: Id
@CommandHandler
constructor(cmd: CreateMySecondAggregateCommand, myFirstAggregateRepository: Repository){
try {
myFirstAggregateRepository.load(cmd.mySecondAggregateId)
// do create the second aggregate
AggregateLifeCycle.apply(MySecondAggregateCreatedEvent(cmd.mySecondAggregateId))
} catch(e: AggregateNotFoundException) {
// reject the command
}
}
}
`
Axon Version: 4.2.1
Assume I’m using all default configurations from axon-spring-boot-starter.
Given this scenario I am unable to init the application because axon fails to inject myFirstAggregateRepository into the second aggregate command handler.