Upgrade to Spring Boot 2.3 and related changes.
This commit is contained in:
@@ -15,9 +15,10 @@
|
||||
*/
|
||||
package org.springframework.hateoas.examples;
|
||||
|
||||
import org.springframework.boot.web.client.RestTemplateCustomizer;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
import org.springframework.hateoas.config.HypermediaRestTemplateConfigurer;
|
||||
|
||||
/**
|
||||
* @author Greg Turnquist
|
||||
@@ -26,7 +27,9 @@ import org.springframework.web.client.RestTemplate;
|
||||
public class ClientConfig {
|
||||
|
||||
@Bean
|
||||
public RestTemplate restTemplate() {
|
||||
return new RestTemplate();
|
||||
RestTemplateCustomizer hypermediaRestTemplateCustomizer(HypermediaRestTemplateConfigurer configurer) {
|
||||
return restTemplate -> {
|
||||
configurer.registerHypermediaTypes(restTemplate);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ package org.springframework.hateoas.examples;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
|
||||
import org.springframework.boot.web.client.RestTemplateBuilder;
|
||||
import org.springframework.hateoas.CollectionModel;
|
||||
import org.springframework.hateoas.EntityModel;
|
||||
import org.springframework.hateoas.Link;
|
||||
@@ -43,8 +44,8 @@ public class HomeController {
|
||||
|
||||
private final RestTemplate rest;
|
||||
|
||||
public HomeController(RestTemplate restTemplate) {
|
||||
this.rest = restTemplate;
|
||||
public HomeController(RestTemplateBuilder restTemplateBuilder) {
|
||||
this.rest = restTemplateBuilder.build();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user