Affects: 5.2.8.RELEASE


Hello,

I have an application that can send very large files over HTTPS with RestTemplate but I cannot buffer the whole file in RAM (not enough memory available). That is why I want to use the streaming capabilities of RestTemplate.

To send large files with RestTemplate we can use the streaming by setting bufferRequestBody to false in a HttpComponentsClientHttpRequestFactory, and create the RestTemplate with this factory

If we do not use interceptors during the request, everything is fine and we can send large files. But if we use interceptors during the request, the streaming part is not called and this can lead to an OutOfMemory error. (I cannot increase the RAM)

This is due to the factory InterceptingClientHttpRequestFactory that is used by RestTemplate as a wrapper when interceptors are present and which does not support streaming.

Is there any chance that this will be fixed in a future version and that we can use streaming with interceptors?

Comment From: bclozel

As seen in #19448, #21531 and #21424 and other related issues - RestTemplate is in maintenance mode for this very reason. We will not evolve this part of Spring Framework and unfortunately we must decline this enhancement request.

For streaming use cases, WebClient is a better fit even in MVC applications.