Merge pull request #7167 from amit2103/BAEL-14274-2
[BAEL-14274] - Fixed article code for https://www.baeldung.com/rest-t…
This commit is contained in:
commit
1f06d82a61
|
@ -188,7 +188,7 @@ public class RestTemplateBasicLiveTest {
|
||||||
final String resourceUrl = fooResourceUrl + '/' + createResponse.getBody()
|
final String resourceUrl = fooResourceUrl + '/' + createResponse.getBody()
|
||||||
.getId();
|
.getId();
|
||||||
final HttpEntity<Foo> requestUpdate = new HttpEntity<>(updatedResource, headers);
|
final HttpEntity<Foo> requestUpdate = new HttpEntity<>(updatedResource, headers);
|
||||||
final ClientHttpRequestFactory requestFactory = getSimpleClientHttpRequestFactory();
|
final ClientHttpRequestFactory requestFactory = getClientHttpRequestFactory();
|
||||||
final RestTemplate template = new RestTemplate(requestFactory);
|
final RestTemplate template = new RestTemplate(requestFactory);
|
||||||
template.setMessageConverters(Arrays.asList(new MappingJackson2HttpMessageConverter()));
|
template.setMessageConverters(Arrays.asList(new MappingJackson2HttpMessageConverter()));
|
||||||
template.patchForObject(resourceUrl, requestUpdate, Void.class);
|
template.patchForObject(resourceUrl, requestUpdate, Void.class);
|
||||||
|
@ -262,7 +262,7 @@ public class RestTemplateBasicLiveTest {
|
||||||
|
|
||||||
// Simply setting restTemplate timeout using ClientHttpRequestFactory
|
// Simply setting restTemplate timeout using ClientHttpRequestFactory
|
||||||
|
|
||||||
ClientHttpRequestFactory getSimpleClientHttpRequestFactory() {
|
ClientHttpRequestFactory getClientHttpRequestFactory() {
|
||||||
final int timeout = 5;
|
final int timeout = 5;
|
||||||
final HttpComponentsClientHttpRequestFactory clientHttpRequestFactory = new HttpComponentsClientHttpRequestFactory();
|
final HttpComponentsClientHttpRequestFactory clientHttpRequestFactory = new HttpComponentsClientHttpRequestFactory();
|
||||||
clientHttpRequestFactory.setConnectTimeout(timeout * 1000);
|
clientHttpRequestFactory.setConnectTimeout(timeout * 1000);
|
||||||
|
|
Loading…
Reference in New Issue