使用postman传递数组调试

使用postman传递数组

以springboot两个接收参数的注解为例:@RequestBody和@RequestParam

一、先简单的写一下springboot的注解@RequestBody和@RequestParam在后台是如何接收数组

   直接上图(自行忽略其他注解)
  1. @RequestBody接收数组

在这里插入图片描述

  1. @RequestParam接收数组

请注意@RequestParam括号里的名称一定得带中括号[ ],后边定义的参数名则不需要
在这里插入图片描述
二、进入正题,使用postman来传递@RequestBody和@RequestParam注解的数组参数

  1. 用postman传递@RequestBody注解的数组

看图操作便是(注意微操,格式需选择JSON格式
在这里插入图片描述
@RequestBody调试参数传入调试是这样的:
在这里插入图片描述

  1. 用postman传递@RequestParam注解的数组

与@RequestBody不同,@RequestParam传递的数组中有多少个值,便排排下来写便是
注意微操,参数名需为key的名称为@RequestParam括号里的名称,而不是定义的数组名
在这里插入图片描述
@RequestParam调试参数传入调试是这样的:
在这里插入图片描述

便是如此…
愿世界和平…

发布了1 篇原创文章 · 获赞 2 · 访问量 51

猜你喜欢

转载自blog.csdn.net/weixin_45156676/article/details/105638465