2016-09-30 3335 views
3

我將我的REST客戶端模塊從HttpClient.executeMethod(method)改爲RestTemplate.postForLocation(uri, obj)。與HttpClient,我會明確釋放該方法的連接:RestTemplate是否會自動釋放連接?

deleteMethod.releaseConnection();

我在SpringRestTemplate內找不到任何等價物。它會自動釋放連接嗎?我想,另一種方法是,在調用RestTemplate.postForLocation之後不做任何事情是安全的嗎?

+2

這可能會回答你的問題,http://stackoverflow.com/questions/31869193/using-spring-rest-template-either-creating-too-many-connections-or-slow –

回答