in src/main/java/org/apache/fineract/cn/command/internal/CommandBus.java [133:148]
private <C> CommandHandlerHolder findCommandHandler(final C command) {
this.logger.debug("CommandBus::findCommandHandler called for {}.", command.getClass().getSimpleName());
final Class<?> commandClass = command.getClass();
this.cachedCommandHandlers.computeIfAbsent(commandClass, findHandler -> {
final Map<String, Object> aggregates = this.applicationContext.getBeansWithAnnotation(Aggregate.class);
for (Object aggregate : aggregates.values()) {
final CommandHandlerHolder commandHandlerHolder = this.getCommandHandlerMethodFromClass(commandClass, aggregate);
if (commandHandlerHolder != null) {
return commandHandlerHolder;
}
}
this.logger.info("Could not find command handler for {}.", commandClass.getSimpleName());
throw new IllegalArgumentException("No command handler found.");
});
return this.cachedCommandHandlers.get(commandClass);
}