You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
WebTestClient has a special case when a Void response is expected. Method WebTestClient.ResponseSpec#returnResult(java.lang.Class<T>) has this documentation comment:
Note that when {@code Void.class} is passed in, the response body is consumed and released.
The same special case logic is not applied to the overloaded version of this method: WebTestClient.ResponseSpec#returnResult(ParameterizedTypeReference<T>). This is a bit unexpected; and caused a memory leak in my tests when I swapped a Class parameter for a ParameterizedTypeReference parameter. The following sample code shows the problem (additional GC is forced to make the leak happen faster; netty's leak detection happens on GC):
WebTestClient
has a special case when aVoid
response is expected. MethodWebTestClient.ResponseSpec#returnResult(java.lang.Class<T>)
has this documentation comment:The same special case logic is not applied to the overloaded version of this method:
WebTestClient.ResponseSpec#returnResult(ParameterizedTypeReference<T>)
. This is a bit unexpected; and caused a memory leak in my tests when I swapped a Class parameter for a ParameterizedTypeReference parameter. The following sample code shows the problem (additional GC is forced to make the leak happen faster; netty's leak detection happens on GC):The workaround is to use the
Class
signature, or consume the response body some other way using e.g. by specifying.consumeWith(...)
.The text was updated successfully, but these errors were encountered: