Trust self signed certificate in Spring Boot

Trust self signed ssl certificate in Spring Boot Rest Template

public RestTemplate getRestTemplateForSelfSsl() throws KeyStoreException, NoSuchAlgorithmException, KeyManagementException {
    TrustStrategy acceptingTrustStrategy = (X509Certificate[] x509Certificates, String s) - > true;
    SSLContext sslContext = org.apache.http.ssl.SSLContexts.custom().loadTrustMaterial(null, acceptingTrustStrategy).build();
    SSLConnectionSocketFactory csf = new SSLConnectionSocketFactory(sslContext, new NoopHostnameVerifier());
    CloseableHttpClient httpClient = HttpClients.custom().setSSLSocketFactory(csf).build();
    HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory();
    RestTemplate restTemplate = new RestTemplate(requestFactory);
    return restTemplate;

public String send(String url, HttpEntity entity, HttpMethod httpMethod) {
    String response;
    try {
        try {
            RestTemplate restTemplate;
            if (url.startsWith("https")) {
                restTemplate = getRestTemplateForSelfSsl();
            } else {
                restTemplate = new RestTemplate();
            ResponseEntity < String > responseEntity =, httpMethod, entity, String.class);
        } catch (HttpStatusCodeException ex) {
    } catch (Exception ex) {
    return response;


  1. The effectiveness of IEEE Project Domains depends very much on the situation in which they are applied. In order to further improve IEEE Final Year Project Domains practices we need to explicitly describe and utilise our knowledge about software domains of software engineering Final Year Project Domains for CSE technologies. This paper suggests a modelling formalism for supporting systematic reuse of software engineering technologies during planning of software projects and improvement programmes in Final Year Project Centers in Chennai.

    Spring Framework has already made serious inroads as an integrated technology stack for building user-facing applications. Spring Framework Corporate TRaining the authors explore the idea of using Java in Big Data platforms.
    Specifically, Spring Framework provides various tasks are geared around preparing data for further analysis and visualization. Spring Training in Chennai

  2. If more people that write articles involved themselves with writing great content like you, more readers would be interested in their writings. I have learned too many things from your article. CE certificate