Interface RestClientSsl


public interface RestClientSsl
Interface that can be used to apply SSL configuration to a RestClient.Builder.

Typically used as follows:

 @Bean
 public MyBean myBean(RestClient.Builder restClientBuilder, RestClientSsl ssl) {
     RestClient restClient = restClientBuilder.apply(ssl.fromBundle("mybundle")).build();
     return new MyBean(restClient);
 }
 
NOTE: Applying SSL configuration will replace any previously configured ClientHttpRequestFactory. The replacement ClientHttpRequestFactory will apply only configured ClientHttpRequestFactorySettings and the appropriate SslBundle.

If you need to configure ClientHttpRequestFactory with more than just SSL consider using a ClientHttpRequestFactoryBuilder.

Since:
3.2.0
  • Method Summary

    Modifier and Type
    Method
    Description
    Consumer<org.springframework.web.client.RestClient.Builder>
    fromBundle(String bundleName)
    Return a Consumer that will apply SSL configuration for the named SslBundle to a RestClient.Builder.
    Consumer<org.springframework.web.client.RestClient.Builder>
    fromBundle(org.springframework.boot.ssl.SslBundle bundle)
    Return a Consumer that will apply SSL configuration for the SslBundle to a RestClient.Builder.
  • Method Details

    • fromBundle

      Consumer<org.springframework.web.client.RestClient.Builder> fromBundle(String bundleName) throws org.springframework.boot.ssl.NoSuchSslBundleException
      Return a Consumer that will apply SSL configuration for the named SslBundle to a RestClient.Builder.
      Parameters:
      bundleName - the name of the SSL bundle to apply
      Returns:
      a Consumer to apply the configuration
      Throws:
      org.springframework.boot.ssl.NoSuchSslBundleException - if a bundle with the provided name does not exist
    • fromBundle

      Consumer<org.springframework.web.client.RestClient.Builder> fromBundle(org.springframework.boot.ssl.SslBundle bundle)
      Return a Consumer that will apply SSL configuration for the SslBundle to a RestClient.Builder.
      Parameters:
      bundle - the SSL bundle to apply
      Returns:
      a Consumer to apply the configuration