[KC-108] resttemplate 설정 변경

This commit is contained in:
2026-01-12 18:21:18 +09:00
parent c90713e2b2
commit ad0c3bc080
2 changed files with 11 additions and 7 deletions

View File

@@ -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();
} }
} }

View File

@@ -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);