title: caused by: java.lang.NoSuchMethodError: org.apache.http.conn.ssl.SSLConnectionSocketFactory
body: <p>I am using Spring Boot, Spring MVC and Spring Web with HttpClient. While trying to create <strong>HttpClient</strong> object in @Configuration class I get exception for following code:</p>
  
  <pre><code>SSLConnectionSocketFactory sslSocketFactory = new SSLConnectionSocketFactory(sslContext, hostnameVerifier);
      Registry&lt;ConnectionSocketFactory&gt; socketFactoryRegistry = RegistryBuilder.&lt;ConnectionSocketFactory&gt;create()
              .register("http", PlainConnectionSocketFactory.getSocketFactory())
              .register("https", sslSocketFactory)
              .build();
  </code></pre>
  
  <p>POM dependencies   </p>
  
  <pre><code>&lt;properties&gt;
    &lt;http.client&gt;4.5.2&lt;/http.client&gt;
    &lt;http.core&gt;4.4.4&lt;/http.core&gt;
  &lt;/&lt;properties&gt;
   &lt;dependency&gt;
              &lt;groupId&gt;org.apache.httpcomponents&lt;/groupId&gt;
              &lt;artifactId&gt;httpcore&lt;/artifactId&gt;
              &lt;version&gt;${http.core}&lt;/version&gt;
          &lt;/dependency&gt;
  &lt;dependency&gt;
              &lt;groupId&gt;org.apache.httpcomponents&lt;/groupId&gt;
              &lt;artifactId&gt;httpclient&lt;/artifactId&gt;
              &lt;version&gt;${http.client}&lt;/version&gt;
          &lt;/dependency&gt;
  </code></pre>
  
  <p><strong>Exception</strong>:</p>
  
  <pre><code>Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.http.client.HttpClient]: Factory method 'getHttpClient' thr
  ew exception; nested exception is java.lang.NoSuchMethodError: org.apache.http.conn.ssl.SSLConnectionSocketFactory.&lt;init&gt;(Ljavax/net/ssl/SSLContext;Ljavax/net
  /ssl/HostnameVerifier;)V                                                                                                                                      
          at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189)                            
          at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)                          
          ... 155 more                                                                                                                                          
  Caused by: java.lang.NoSuchMethodError: org.apache.http.conn.ssl.SSLConnectionSocketFactory.&lt;init&gt;(Ljavax/net/ssl/SSLContext;Ljavax/net/ssl/HostnameVerifier;)
  V                                                                                                                                                             
          at wsclient.RestClientConfig.getHttpClient(RestClientConfig.java:182)                                                         
          at wsclient.RestClientConfig$$EnhancerBySpringCGLIB$$d3a9da1b.CGLIB$getHttpClient$2(&lt;generated&gt;)                              
          at wsclient.RestClientConfig$$EnhancerBySpringCGLIB$$d3a9da1b$$FastClassBySpringCGLIB$$a56984ae.invoke(&lt;generated&gt;)           
          at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)                                                                      
          at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:309)             
          at wsclient.RestClientConfig$$EnhancerBySpringCGLIB$$d3a9da1b.getHttpClient(&lt;generated&gt;)                                      
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)                                                                                        
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)                                                                      
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)                                                              
          at java.lang.reflect.Method.invoke(Method.java:497)                                                                                                   
          at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)                            
          ... 156 more 
  </code></pre>
  
  <p>Any help or suggestions appreciated</p>