spring-hateoas
spring-hateoas copied to clipboard
RestClient support customiser
As of Spring Boot 3.2.0 RestClient has been added via Spring Framework to replace WebClient. Is there a replacement for hypermediaWebClientCustomizer?
RestClient
works with a RestTemplate
under the covers, so all hypermedia-related customizations would have to be (and are, in fact) applied to that, right?
Yes this is my understanding. Currently I have a bean like this:
@Bean
public RestClientCustomizer hypermediaRestClientCustomizer(WebConverters webConverters) {
return builder -> builder.messageConverters(webConverters::augmentClient);
Which works fine, as you said. Is there plans to put a wrapper around this like has been done for resttemplate & web client?
This worked for me, but only if I use RestClient.ResponseSpec.toEntity()
. RestClient.ResponseSpec.body()
failed to parse the response to a PagedModelType.
Maybe there should be at least a section in the documentation what to do or expect when you want to use hateoas with RestClient. I don't think that many/all users of the hateoas Lib with "regular" spring knowledge know what to do in this case.