---
title: "feign数组传参"
author: "alwaysperfect"
date: "2018-04-24T15:24:08Z"
tags: []
categories: ["行业应用"]
slug: "feign"
draft: false
lastmod: "2018-04-24T15:24:08Z"
id: 2419883
url: "https://alwaysperfect.iteye.com/blog/2419883"
---

```
服务端：
@RequestMapping("wssp2")
@ResponseBody
public Map<String, String> wssp2(@RequestBody List<User> users) {
    Map<String, String> result = new HashMap<>();
    result.put("code", "200");
    result.put("message", "成功");

    StringBuilder other = new StringBuilder();
    other.append("users size：").append(users.size()).append("；");
    for (User user : users) {
        other.append(user.getName()).append("；");
    }
    result.put("other", other.toString());
    return result;
}
客户端：
@FeignClient(name = "wsClient", url = "${zdry.base.base-api-url}/test")
```

```
public interface WsClient {

    @RequestMapping(value = "/wssp", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
    public String wssp(@RequestBody UserVo user);

    @RequestMapping(value = "/wssp2", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
    public String wssp2(@RequestBody List<UserVo> users);

}
```