Spring Cloud Feign Client重复列表值 [英] Spring Cloud Feign Client duplicate list values

查看:707
本文介绍了Spring Cloud Feign Client重复列表值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用Spring cloud Feign映射我的其余客户端的接口.

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

它正在复制列表值!

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

I already tried using an array, an integer and string generic list, but no success.

推荐答案

@RequestMapping删除?ids={ids}可以解决此问题.只需 path 参数即可.

Remove ?ids={ids} from @RequestMapping fixes the problem. Only path parameters need to go there.

这篇关于Spring Cloud Feign Client重复列表值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆