spring-hateoas icon indicating copy to clipboard operation
spring-hateoas copied to clipboard

RestClient support customiser

Open M-Whitaker opened this issue 1 year ago • 4 comments

As of Spring Boot 3.2.0 RestClient has been added via Spring Framework to replace WebClient. Is there a replacement for hypermediaWebClientCustomizer?

M-Whitaker avatar Nov 03 '23 13:11 M-Whitaker

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?

odrotbohm avatar Nov 08 '23 14:11 odrotbohm

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?

M-Whitaker avatar Nov 09 '23 23:11 M-Whitaker

This worked for me, but only if I use RestClient.ResponseSpec.toEntity(). RestClient.ResponseSpec.body() failed to parse the response to a PagedModelType.

bertsanders avatar Dec 22 '23 21:12 bertsanders

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.

pcornelissen avatar Jul 07 '24 12:07 pcornelissen