RestTemplate 会自动释放连接吗?

Does RestTemplate automatically release connection?

我正在将我的 REST 客户端模块从 HttpClient.executeMethod(method) 转移到 RestTemplate.postForLocation(uri, obj)。使用 HttpClient,我将显式释放方法的连接:

deleteMethod.releaseConnection();

我在 Spring RestTemplate 中找不到任何等效项。它会自动释放连接吗?我想,另一种提问方式是,在调用 RestTemplate.postForLocation?

之后不做任何事情是否安全?

spring 模板的目标之一是简化多余的事情。 RestTemplate 也不例外,它会为您管理连接。

你可以在这里看到更多。

http://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/web/client/RestTemplate.html