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

报错截图:

报错内容:

复制代码
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注解,才能接收

java 复制代码
    @DeleteMapping
    public R<String> delete(@RequestParam List<Long> ids){
        setmealService.deleteWithDish(ids);
        return R.success("删除套餐成功");
    }

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

相关推荐
kruptos4 小时前
分布式系统怎么“选主“?Raft 共识一次讲清
开发语言·分布式·php·共识算法
xcl09254 小时前
幼儿托育系统开发实战:从需求分析到上线全流程指南
java·大数据·需求分析
吴声子夜歌4 小时前
ApacheCommons——commons-cli(命令行参数解析)
java·开发语言·apache
小小猪的春天4 小时前
Java 手写第一个 MCP Server:Spring AI MCP 半小时跑通
java·人工智能·spring boot·ai编程
find1star4 小时前
LeetCode 141:环形链表
java·算法·leetcode·链表
今天AI了吗5 小时前
DeepSeek Harness 深度解析:从评测架构到实战落地
java·网络·数据库·人工智能·架构·java-ee
benchmark_cc5 小时前
REST API 和 Python SDK 应该怎么选?量化交易数据接口选型实战
开发语言·python·数据分析·pandas·量化交易·股票数据·quantdash
王的宝库5 小时前
Go 项目结构:从单文件到标准工程布局
开发语言·后端·golang
Tairitsu_H5 小时前
[C++] 深入理解红黑树:封装set与map
开发语言·c++·set·map·红黑树·模拟实现
许彰午5 小时前
27-AuthService登录链路
java·低代码·架构