I am creating this bean:
@Bean("MyRestTemplate")
public RestTemplate myRestTemplate(final RestTemplateBuilder restTemplateBuilder) {
return restTemplateBuilder.setBufferRequestBody(false).build();
}
And i am getting the error:
Error creating bean with name 'KSHSignRestTemplate' defined in bla.bla.bla.MyProperties: Failed to instantiate [org.springframework.web.client.RestTemplate]: Factory method 'myRestTemplate' threw exception with message: OkHttp3ClientHttpRequestFactory does not support request body buffering
This is happening since I migrated spring boot from spring 2.x to 3.1.2. I have done hours of research but I could not find any documentation around this issue.
I slightly changed the name of the methods and classes so it's more suitable for the web.
I don't know why but removing .setBufferRequestBody(false) fixes the issue.