No primary or single public constructor found for interface java.util.List - and no default constructor found either

本质:传过来的参数类型与待接收的参数类型不一致。

 

我传输过来的参数如下:

 

 

我待接收的参数如下:

 

 

你可能会说,将List<Long> 改为Long!

对,这是一种方法,但我想要该函数既能介绍单个参数,又能接收多个参数。在业务上即单个删除与批量删除合并。

 

所以最终解决方法:

    @DeleteMapping

  // 强制参数绑定 public Result deleteMeal(@RequestParam List
<Long> ids){}

 

posted @ 2023-02-25 20:35  先娶国王后取经  阅读(1228)  评论(0编辑  收藏  举报