Closed david-randoll closed 1 year ago
After 5 hours, I going to answer my own question to yes.
The below broke my code. I was passing in JPA Entity here that has one too many relationships and thru object mapper a stack overflow error was thrown.
@Component
@Order(1)
@Slf4j
class LoggingMiddleware implements Command.Middleware {
@Override
public <R, C extends Command<R>> R invoke(C command, Next<R> next) {
var requestJsonString = objectMapper.valueToTree(command).toString();
var commandName = command.getClass().getName();
log.info("Start {}: {}", commandName, requestJsonString);
R response = next.invoke();
var responseJsonString = objectMapper.valueToTree(response).toString();
log.info("End {}: {}", commandName, responseJsonString);
return response;
}
}
Love this library. Coming from .NET makes it tolerable to work with Java haha.
Is possible from a Command.Handler to inject Pipeline and to call another handler?
I am using Spring boot.