Proper way of streaming using ResponseEntity and making sure the InputStream gets closed
you can try to use StreamingResponseBody StreamingResponseBody A controller method return value type for asynchronous request processing where the application can write directly to the response OutputStream without holding up the Servlet container thread. Because you are working on a separate thread, writing directly to the response, your problem to call close() before return is … Read more