Upgrade to Spring Boot 2.3 and related changes.

This commit is contained in:
Greg L. Turnquist
2020-10-20 16:24:26 -05:00
parent 1d12ed185c
commit 5f74daf4bd
13 changed files with 44 additions and 35 deletions

View File

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

View File

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