Merge pull request '[KC-108] resttemplate 설정 변경' (#199) from feat/infer_dev_260107 into develop
Reviewed-on: https://kamco.gitea.gs.dabeeo.com/dabeeo/kamco-dabeeo-backoffice/pulls/199
This commit is contained in:
@@ -1,21 +1,24 @@
|
|||||||
package com.kamco.cd.kamcoback.config.resttemplate;
|
package com.kamco.cd.kamcoback.config.resttemplate;
|
||||||
|
|
||||||
import java.time.Duration;
|
import java.net.Proxy;
|
||||||
import java.util.List;
|
import lombok.extern.log4j.Log4j2;
|
||||||
import org.springframework.boot.web.client.RestTemplateBuilder;
|
import org.springframework.boot.web.client.RestTemplateBuilder;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.http.client.SimpleClientHttpRequestFactory;
|
||||||
import org.springframework.web.client.RestTemplate;
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
|
@Log4j2
|
||||||
@Configuration
|
@Configuration
|
||||||
public class RestTemplateConfig {
|
public class RestTemplateConfig {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public RestTemplate restTemplate(RestTemplateBuilder builder) {
|
public RestTemplate restTemplate(RestTemplateBuilder builder) {
|
||||||
return builder
|
SimpleClientHttpRequestFactory f = new SimpleClientHttpRequestFactory();
|
||||||
.connectTimeout(Duration.ofSeconds(2))
|
f.setProxy(Proxy.NO_PROXY); // 시스템/환경 프록시 무시
|
||||||
.readTimeout(Duration.ofSeconds(3))
|
f.setConnectTimeout(2000);
|
||||||
.additionalInterceptors(List.of(new RetryInterceptor()))
|
f.setReadTimeout(3000);
|
||||||
.build();
|
|
||||||
|
return builder.requestFactory(() -> f).additionalInterceptors(new RetryInterceptor()).build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -215,6 +215,7 @@ public class InferenceResultService {
|
|||||||
|
|
||||||
HttpHeaders headers = new HttpHeaders();
|
HttpHeaders headers = new HttpHeaders();
|
||||||
headers.setContentType(MediaType.APPLICATION_JSON);
|
headers.setContentType(MediaType.APPLICATION_JSON);
|
||||||
|
headers.setAccept(List.of(MediaType.APPLICATION_JSON));
|
||||||
|
|
||||||
ExternalCallResult result =
|
ExternalCallResult result =
|
||||||
externalHttpClient.call(inferenceUrl, HttpMethod.POST, dto, headers);
|
externalHttpClient.call(inferenceUrl, HttpMethod.POST, dto, headers);
|
||||||
|
|||||||
Reference in New Issue
Block a user