Using Axon 4, Event sourcing aggregate's events are not replayed when a command is issued.

I am having a hard time to get this working. I went through the axon-bank example in axon 3, when MoneyTransferSaga sends WithdrawMoneyCommand, before this command is handled by the handler, the framework replays all stored events to construct the aggregate. This is all working fine. Now I am using Axon 4 and trying to do the same thing in my own project, I am not seeing the replaying of the events, thus the logic is all messed up. By default, Axon 4 is using event sourcing repository, I didn’t do any JPA entity configuration. And I made sure that my aggregate has @AggregateIdentifier, and my command has @TargetAggregateIdentifier. I did notice that the code changed in AggregateAnnotationCommandHandler.java from axon 3 to axon 4.(But looks like the major logic is still the same).

However in my debugger, this private class is never invoked:

private class AggregateCommandHandler implements MessageHandler<CommandMessage<?>> {
    private final MessageHandlingMember<? super T> handler;

    public AggregateCommandHandler(MessageHandlingMember<? super T> handler) {
        this.handler = handler;
    }

    public Object handle(CommandMessage<?> command) throws Exception {
        VersionedAggregateIdentifier iv = AggregateAnnotationCommandHandler.this.commandTargetResolver.resolveTarget(command);
        return AggregateAnnotationCommandHandler.this.repository.load(iv.getIdentifier(), iv.getVersion()).handle(command);
    }

    public boolean canHandle(CommandMessage<?> message) {
        return this.handler.canHandle(message);
    }
}

Instead, this private class is used when it should first load the aggregate:


Sorry, figured out the problem. My bad. I accidentally put the command handler as constructor which should have a normal method name. This caused isFactory flag set to true for the command handler. Thus the execution always goes to the constructor command handler.