I had upgraded Spring Boot version to 3.4.1. I also use spring-cloud-contract-wiremock and httpclient5. I have this RestClient configuration.
ClientHttpRequestFactory factory = new BufferingClientHttpRequestFactory(requestFactory);
return RestClient.builder().requestFactory(factory)
.requestInterceptors(interceptors -> interceptors.addAll(
List.of(new ClientHttpRequestInterceptor(),
new RequestResponseLoggingInterceptor())))
.build();
On running application tests, I get this:
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.http.client.ClientHttpRequestFactoryBuilder]: Factory method 'clientHttpRequestFactoryBuilder' threw exception with message: org/apache/hc/client5/http/ssl/TlsSocketStrategy
This is a problem with the used dependency. I encountered the same issue when running a project made using Springboot Initializr for version 3.4.1. As a fix, I specified the dependency version of httpclient5 to 5.4.1.
If you are using maven as your dependency manager, you can add this to your pom.xml.
<dependency>
<groupId>org.apache.httpcomponents.client5</groupId>
<artifactId>httpclient5</artifactId>
<version>5.4.1</version>
</dependency>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With