5. HTTP Client Support

Spring CredHub CredHubOperations supports multiple HTTP client libraries to communicate with the CredHub API. The following libraries are supported:spring-doc.cn

Choosing a specific client library requires the appropriate dependency to be available on the application classpath. The application classpath will be inspected for each client library in the order listed above.spring-doc.cn

Spring CredHub ReactiveCredHubOperations only supports the Netty HTTP client library.spring-doc.cn

5.1. Apache HttpComponents

To use Apache HttpComponents to communicate with CredHub, add the following dependency to the application:spring-doc.cn

<dependency>
  <groupId>org.apache.httpcomponents</groupId>
  <artifactId>httpclient</artifactId>
</dependency>
Apache HttpClient’s wire logging can be enabled through logging configuration. Make sure to not accidentally enable wire logging as logs may expose traffic (including tokens and secrets) between your application and CredHub in plain text.

5.2. OkHttp 3

To use OkHttp 3 to communicate with CredHub, add the following dependency to the application:spring-doc.cn

<dependency>
  <groupId>com.squareup.okhttp3</groupId>
  <artifactId>okhttp</artifactId>
</dependency>

5.3. Netty

To use Netty to communicate with CredHub, add the following dependency to the application:spring-doc.cn

<dependency>
  <groupId>io.netty</groupId>
  <artifactId>netty-all</artifactId>
</dependency>