Skip to content
This repository was archived by the owner on Dec 5, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;
import org.springframework.context.annotation.Bean;
import org.springframework.beans.factory.annotation.Autowired;

import javax.annotation.PostConstruct;
import java.net.InetSocketAddress;
Expand All @@ -15,7 +17,12 @@
public final class RestProxyTemplate {
private final Logger logger = LoggerFactory.getLogger(getClass());

private RestTemplate restTemplate = new RestTemplate();
@Autowired RestTemplate restTemplate;

@Bean
public RestTemplate restTemplate() {
return new RestTemplate();
}

@Value("${proxy.host:}")
private String host;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public <T> Future<Resource<T>> getResource(URI url, TypeReferences.ResourceType<
InterruptedException, IOException {
RequestEntity<Void> request = RequestEntity.get(url).accept(HAL_JSON).build();
LOG.debug("Requesting: " + request.toString());
Resource<T> body = halTemplate.exchange(request, type).getBody();
Resource<T> body = restProxyTemplate.getRestTemplate().exchange(request, type).getBody();
LOG.debug("Received: " + body.toString());
return new AsyncResult<>(body);
}
Expand Down