I have an Aggregate class that has
i) 1 CommandHandler that receives a CreateAccountCommand
ii) 1 EventSourceHandling that receives AccountCreatedEvent
Correspondingly, in another package, I’ve @EventHandler for the AccountCreatedEvent. However, it is not getting invoked. I’m using spring boot application.
@Component
class EventHandlingComponent {
@Autowired AccountRepository repo;
@EventHandler
public void on(AccountCreatedEvent event )
{
// save to repository ;
}
}
I’m using spring boot application with this added as a dependency.
<dependency>
<groupId>org.axonframework</groupId>
<artifactId>axon-spring-boot-starter</artifactId>
<version>4.5.3</version>
<exclusions>
<exclusion>
<groupId>org.axonframework</groupId>
<artifactId>axon-server-connector</artifactId>
</exclusion>
</exclusions>
</dependency>
I’ll be really thankful if someone can point me to what mistake I’m making.