Spring Cloud Feign 客户端重复列表值
Spring Cloud Feign Client duplicate list values
我使用 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
它正在复制列表值!
我已经尝试过使用数组、整数和字符串泛型列表,但没有成功。
从 @RequestMapping
中删除 ?ids={ids}
解决了这个问题。只有 path 参数需要去那里。
我使用 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
它正在复制列表值!
我已经尝试过使用数组、整数和字符串泛型列表,但没有成功。
从 @RequestMapping
中删除 ?ids={ids}
解决了这个问题。只有 path 参数需要去那里。