3

I can't find how to pass a Map of query parameters to uriBuilder even with a method found on Google which explains that we need to pass a LinkedMultiValueMap.

This is my method :

public <T> Mono<T> get(String uri, LinkedMultiValueMap params) {
        return this.webClient
                .get()
                .uri(builder -> builder
                        .path(uri)
                        .queryParam(params)
                        .build())
                .retrieve()
                .bodyToMono(new ParameterizedTypeReference<T>() {
       });
}

But I always have the following error :

queryParam (java.lang.String, Object...) in UriBuilder cannot be applied to (org.springframework.util.LinkedMultiValueMap)

It's probably really simple but I can't figured it out :/

Thanks for your help.

UPDATE :

Finally found the solution a few minutes after sending my request here ! In order to use a map for queryParam I must use .queryParams instead of .queryParam ^^

Pierre Jones
  • 620
  • 1
  • 11
  • 24
  • 2
    great you found the issue by yourself. just write an answer to your questoin or just delete it. – Patrick Dec 05 '19 at 10:14

0 Answers0