Alternative approach for HttpComponentsClientHttpRequestFactory where it got deprecated for SpringBoot 3.3 and above
RestTemplate restTemplate = new RestTemplate(); TrustStrategy acceptingTrustStrategy = (X509Certificate[] chain, String authType) -> true; SSLContext sslContext = org.apache.http.ssl.SSLContexts.custom().loadTrustMaterial(null, acceptingTrustStrategy).build(); SSLConnectionSocketFactory csf = new SSLConnectionSocketFactory(sslContext); CloseableHttpClient closableHttpClient = HttpClients.custom().setSSLSocketFactory(csf).build(); HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory(); requestFactory.setHttpClient((HttpClient) closableHttpClient); restTemplate = new RestTemplate(requestFactory); In the above code, I am trying to skip the SSL validation. When I am trying […]
Alternative approach for HttpComponentsClientHttpRequestFactory where it got deprecated for SpringBoot 3.3 and above
RestTemplate restTemplate = new RestTemplate(); TrustStrategy acceptingTrustStrategy = (X509Certificate[] chain, String authType) -> true; SSLContext sslContext = org.apache.http.ssl.SSLContexts.custom().loadTrustMaterial(null, acceptingTrustStrategy).build(); SSLConnectionSocketFactory csf = new SSLConnectionSocketFactory(sslContext); CloseableHttpClient closableHttpClient = HttpClients.custom().setSSLSocketFactory(csf).build(); HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory(); requestFactory.setHttpClient((HttpClient) closableHttpClient); restTemplate = new RestTemplate(requestFactory); In the above code, I am trying to skip the SSL validation. When I am trying […]
Alternative approach for HttpComponentsClientHttpRequestFactory where it got deprecated for SpringBoot 3.3 and above
RestTemplate restTemplate = new RestTemplate(); TrustStrategy acceptingTrustStrategy = (X509Certificate[] chain, String authType) -> true; SSLContext sslContext = org.apache.http.ssl.SSLContexts.custom().loadTrustMaterial(null, acceptingTrustStrategy).build(); SSLConnectionSocketFactory csf = new SSLConnectionSocketFactory(sslContext); CloseableHttpClient closableHttpClient = HttpClients.custom().setSSLSocketFactory(csf).build(); HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory(); requestFactory.setHttpClient((HttpClient) closableHttpClient); restTemplate = new RestTemplate(requestFactory); In the above code, I am trying to skip the SSL validation. When I am trying […]
Alternative approach for HttpComponentsClientHttpRequestFactory where it got deprecated for SpringBoot 3.3 and above
RestTemplate restTemplate = new RestTemplate(); TrustStrategy acceptingTrustStrategy = (X509Certificate[] chain, String authType) -> true; SSLContext sslContext = org.apache.http.ssl.SSLContexts.custom().loadTrustMaterial(null, acceptingTrustStrategy).build(); SSLConnectionSocketFactory csf = new SSLConnectionSocketFactory(sslContext); CloseableHttpClient closableHttpClient = HttpClients.custom().setSSLSocketFactory(csf).build(); HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory(); requestFactory.setHttpClient((HttpClient) closableHttpClient); restTemplate = new RestTemplate(requestFactory); In the above code, I am trying to skip the SSL validation. When I am trying […]