I have this piece of code working fine on a project that uses RestTemplateBuilder 1.5.14
this.restTemplate = restTemplateBuilder
.setConnectTimeout(connectTimeout)
.setReadTimeout(readTimeout)
.requestFactory(new MyHttpComponentFactoryBuilder()
.build())
.build();
After updating to RestTemplateBuilder 2.1.5
I have this piece of code:
this.restTemplate = restTemplateBuilder
.setConnectTimeout(Duration.ofMillis(connectTimeout))
.setReadTimeout(Duration.ofMillis(readTimeout))
.requestFactory(new MyHttpComponentFactoryBuilder().build().getClass())
.build();
but when running the code I have a InvocationTargetException / NullPointerException
that dissapears when deleting the line .requestFactory(new MyHttpComponentFactoryBuilder().build().getClass())
, but debugging new MyHttpComponentFactoryBuilder().build().getClass()
is not null