我只想安靜的傳個數組類型的參數, 為什么各種報錯...
@DeleteMapping("del") @ApiOperation(value = "刪除") public Integer deleteMan(@RequestBody List idList) {
...
不行, 報錯:
Cannot generate variable name for non-typed Collection parameter type
改吧:
@DeleteMapping("del") @ApiOperation(value = "刪除") public Integer deleteMan(@RequestBody ArrayList idList) { ...
不行, 這回不報錯了, 但是連參數都傳遞不了, idList 永遠值是空的,, 改成 ArrayList<String> 也是不行的
改吧
@DeleteMapping("del") @ApiOperation(value = "刪除") public Integer deleteMan(@RequestBody String[] idList) { ...
還是不行, 再改:
@DeleteMapping("del") @ApiOperation(value = "刪除") public Integer deleteMan(String[] idList) { ...
這回倒是可以了, 但是, 傳參格式不是原來那樣的... 期望是["aa", "bb"] , 但現在必須是 aa, bb, 而且 aa/bb 不能有引號, 否則就奇怪了.
百度看看, 一堆這樣的, 似乎沒有我的答案, 大家都沒遇見過??
bing 的結果也差不多...
隨便看看吧:
http://www.docjar.com/html/api/org/springframework/core/Conventions.java.html
https://blog.csdn.net/z69183787/article/details/52817479?locationNum=7&fps=1
...
好像確實是 后端報錯了: 在 Conventions.java 的這個 地方
- if (valueClass == null) {
- throw new IllegalArgumentException(
- "Cannot generate variable name for non-typed Collection parameter type");
改吧:
@DeleteMapping("del") @ApiOperation(value = "刪除") public Integer deleteMan(@RequestBody List<String> idList) { ...
這回可以了... 恍然大悟.