List of usage examples for org.springframework.web.client AsyncRestTemplate getAsyncRequestFactory
@Override
public org.springframework.http.client.AsyncClientHttpRequestFactory getAsyncRequestFactory()
From source file:org.springframework.boot.actuate.metrics.ambari.restclient.AsyncAmbariMetricsCollectorRestClient.java
private AsyncRestTemplate createTimelineClient() { MappingJackson2HttpMessageConverter mc = new MappingJackson2HttpMessageConverter(); JaxbAnnotationModule module = new JaxbAnnotationModule(); mc.getObjectMapper().registerModule(module); mc.getObjectMapper().setSerializationInclusion(Include.NON_NULL); AsyncRestTemplate restTemplate = new AsyncRestTemplate(); restTemplate.getMessageConverters().clear(); restTemplate.getMessageConverters().add(mc); SimpleClientHttpRequestFactory requestFactory = (SimpleClientHttpRequestFactory) restTemplate .getAsyncRequestFactory();/*from w w w. j a v a 2 s .c o m*/ requestFactory.setReadTimeout(5000); requestFactory.setConnectTimeout(5000); return restTemplate; }