spring-projects / spring-hateoas

Spring HATEOAS - Library to support implementing representations for hyper-text driven REST web services.
https://spring.io/projects/spring-hateoas
Apache License 2.0
1.03k stars 474 forks source link

RestClient support customiser #2038

Open M-Whitaker opened 8 months ago

M-Whitaker commented 8 months ago

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

odrotbohm commented 8 months ago

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?

M-Whitaker commented 8 months ago

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?

bertsanders commented 7 months ago

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

pcornelissen commented 2 weeks ago

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.