Spring Cloud Feign Client duplicate list values

橙三吉。 提交于 2019-12-12 14:05:59

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!