Spring / Spring CredHub Interview questions
How does Spring CredHub's ReactiveCredHubTemplate differ internally from CredHubTemplate?
Both implement the same set of sub-operation accessors, but everything underneath is swapped for a non-blocking equivalent. CredHubTemplate is built on a RestTemplate and its methods return the value directly, blocking the calling thread until the HTTP response arrives. ReactiveCredHubTemplate is built on a WebClient and its methods return a Mono<T> (or Flux<T> for multi-result calls like a partial-name search), so nothing happens until something subscribes.
That difference shows up in the escape-hatch methods too: CredHubOperations.doWithRest(RestOperationsCallback) exposes the underlying RestTemplate for a custom blocking call, while ReactiveCredHubOperations.doWithWebClient(...) exposes the WebClient for a custom reactive one.
Both templates share the same request/response JSON model and the same auto-configured authentication — mTLS or OAuth2 — from spring.credhub.* properties, so switching an app from one to the other is mostly a matter of changing which bean gets injected and adapting call sites to handle a publisher instead of a plain return value.
More Related questions...