问题
I have this interface mapping my rest client using Spring cloud Feign.
@FeignClient(url = "http://localhost:8080")
public interface RestClient {
@RequestMapping(value = "?ids={ids}", method = GET)
List<Posicao> get(@RequestParam(value = "ids") List ids);
}
I have a list in my parameters, calling the client I have this request:
restClient.get(Arrays.asList(1, 2));
http://localhost:8080/ids=1,2,1,2
It's duplicating the list values!
I already tried using an array, an integer and string generic list, but no success.
回答1:
Remove ?ids={ids}
from @RequestMapping
fixes the problem. Only path parameters need to go there.
来源:https://stackoverflow.com/questions/32098906/spring-cloud-feign-client-duplicate-list-values