0
我用春RestTemplate getForObject包含重複標題重複使用它多次請求後
@Autowired
private RestTemplate restTemplate;
在我的每一個用法。我初始化RestTemplate在我的應用程序類爲:
@Bean
public RestTemplate restTemplate() {
SimpleClientHttpRequestFactory httpRequestFactory = new SimpleClientHttpRequestFactory();
httpRequestFactory.setConnectTimeout(30 * 1000);
httpRequestFactory.setReadTimeout(30 * 1000);
return new RestTemplate(httpRequestFactory);
}
請建議我爲這個問題的原因。還糾正我,如果我在錯誤的反正。
表現出一定的日誌。 – Barath
就我所知'@ Bean'創建一個單例 –