<bean id="requestConfigBuilder" class="org.apache.http.client.config.RequestConfig.Builder">
<property name="connectionRequestTimeout" value="2000"/>
<property name="connectTimeout" value="500"/>
<property name="socketTimeout" value="3000"/>
</bean>
<bean id="httpClientBuilder" class="org.apache.http.impl.client.HttpClientBuilder" factory-method="create">
<property name="connectionManager">
<bean class="org.apache.http.impl.conn.PoolingHttpClientConnectionManager">
<property name="maxTotal" value="100"/>
<property name="defaultMaxPerRoute" value="20"/>
</bean>
</property>
<property name="defaultRequestConfig">
<bean factory-bean="requestConfigBuilder" factory-method="build"/>
</property>
</bean>
<bean id="httpClient" factory-bean="httpClientBuilder" factory-method="build"/>