No primary or single unique constructor found for interface java.util.List

报错截图:

No primary or single unique constructor found for interface java.util.List_第1张图片

报错内容:

2023-08-04 15:46:32.884 ERROR 14260 --- [io-8080-exec-10] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.IllegalStateException: No primary or single unique constructor found for interface java.util.List] with root cause

java.lang.IllegalStateException: No primary or single unique constructor found for interface java.util.List

报错原因及修改方案:

对于非基本类型的参数,应该有@RequestParam注解,才能接收

    @DeleteMapping
    public R delete(@RequestParam List ids){
        setmealService.deleteWithDish(ids);
        return R.success("删除套餐成功");
    }


前后端交换注意多个参数接收需要有注解@RequestParam

你可能感兴趣的:(bug,java,list,开发语言)