使用postman发送post请求参数是List<Integer>遇到的问题

前言

当使用SpringCloud框架时,
例如

# 接口方法一定要和接口实现类方法一样,最好是直接复制
@FeignClient(value = "xxx")
public interface DepartmentApi {
@PostMapping("/xxx/getDepartmentLocationNamesByDepIds")
BaseResult<Map<Integer,String>> getDepartmentLocationNamesByDepIds(@RequestBody List<Integer> depIdList);
}

@RestController
@RequestMapping("/department")
public class DepartmentController {
@RequestMapping("/getDepartmentLocationNamesByDepIds")
public BaseResult<Map<Integer,String>> getDepartmentLocationNamesByDepIds(@RequestBody List<Integer> depIdList){
}

一、代码

在这里插入图片描述

二、postman使用

@RequestBody List<Integer> depIdList
1、@RequestBody代表使用post请求
2、List<Integer> depIdList
这个参数在postman中是这样的[8788,8789,8791]

在这里插入图片描述

三、idea中参数映射成功

在这里插入图片描述

四、遇到的问题

在这里插入图片描述

五、相关参考文档

1、@RequestBody与post请求的关系
2、@RequestBody和@RequestParam的请求方式get和post关系
3、POST、GET、@RequestBody和@RequestParam区别

  • 2
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值