Spring Cloud Feign 客户端重复列表值

2024-01-09

我有这个接口使用 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);
}

我的参数中有一个列表,调用客户端时我有以下请求:

restClient.get(Arrays.asList(1, 2));

http://localhost:8080/ids=1,2,1,2 http://localhost:8080/ids=1,2,1,2

它重复了列表值!

我已经尝试使用数组、整数和字符串通用列表,但没有成功。


Remove ?ids={ids} from @RequestMapping解决问题。仅有的path参数需要去那里。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Spring Cloud Feign 客户端重复列表值 的相关文章

随机推荐