we have in our project a endpoint that returns in 30 seconds avg, for this reason, we suggest turn this endpoint in async
but, the services is not working anymore when using
@PostMapping("/alocacaoPorPeriodo")
public void alocacaoPorPeriodo(@RequestParam(required = true) Date dataInicio, @RequestParam(required = true) Date dataFim) {
CompletableFuture.runAsync(() -> alocacaoServive.alocarPorPeriodo(dataInicio, dataFim));
}
The error happens when service call delete, save or update methods from jpa repository. Get methods is still working.
No thread-bound request found: Are you referring to request attributes outside of an actual web request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and still receive this message, your code is probably running outside of DispatcherServlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request.
this is the unique change that we have made to turn async, did I forget something?
thx