No primary or default constructor found for interface java.util.List

这篇具有很好参考价值的文章主要介绍了No primary or default constructor found for interface java.util.List。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

有时候我们前端会传一些 list 集合的参数,如果 list 集合的存储的类型是对象,通过 json 就可以封装,后端使用注解 @RequestBody 可以接收。如果是想传递通过装箱后的基本类型的 list ,需要使用到注解 @RequestParam。

后端没有使用 @RequestParam,swagger和postman传参数就会报这个错误

Request processing failed; nested exception is java.lang.IllegalStateException: No primary or default constructor found for interface java.util.List

No primary or default constructor found for interface java.util.List,java,swagger,postman,java,前端,postman
No primary or default constructor found for interface java.util.List,java,swagger,postman,java,前端,postman
加上 @RequestParam 注解

@RequestParam("idLists") List<Long> idLists

传参方式有两种
一种是直接写成以英文逗号分开的字符串:
No primary or default constructor found for interface java.util.List,java,swagger,postman,java,前端,postman
No primary or default constructor found for interface java.util.List,java,swagger,postman,java,前端,postman
另外一种就是分开传参:
No primary or default constructor found for interface java.util.List,java,swagger,postman,java,前端,postman
No primary or default constructor found for interface java.util.List,java,swagger,postman,java,前端,postman文章来源地址https://www.toymoban.com/news/detail-517456.html

到了这里,关于No primary or default constructor found for interface java.util.List的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包赞助服务器费用

相关文章

  • java.lang.IllegalStateException: No primary or single unique constructor found for interface org.spr

    在项目中添加如上配置文件,主要是重写 addArgumentResolvers 方法,如果还是报同样的错误,请确保项目中只有一个类 继承了 WebMvcConfigurationSupport,在这个类中重写 addArgumentResolvers 方法。

    2024年02月13日
    浏览(34)
  • 服务器报500错误 No primary or single unique constructor found for interface java.util.List

     批量删除日志记录 前端请求 URL:http://localhost:8080/system/log? ids=3,4,5 Method:DELETE 后端接口: 报错:java.lang.IllegalStateException: No primary or single unique constructor found for interface java.util.List 解决方法:添加@RequestParam注解 原因分析:  由于 Spring Boot 默认情况下会尝试使用请求参数的值来创建

    2024年02月07日
    浏览(14)
  • springboot传递List类型参数报错 No primary or single unique constructor found for interface java.util.List

    springboot传递List类型参数报错 No primary or single unique constructor found for interface java.util.List

    昨天在做毕设进行一对多插入的时候 出现了500错误 先看代码 mapper层代码 这里我是list集合进行一对多插入 控制层 前端  页面展示 然后页面显示500错误  查看控制台   报错:No primary or single unique constructor found for interface java.util.List     at org.springframework.beans.BeanUtils.getResol

    2024年02月11日
    浏览(9)
  • 请求500失败-No primary or single unique constructor found for interface xxx

    请求500失败-No primary or single unique constructor found for interface xxx

    错误:No primary or single unique constructor found for interface java.util.List(没有为List接口找到主要的或唯一的构造函数) 原因:请求的参数没有匹配上处理函数的参数 解决:为List参数添加@RequestParam(\\\"strList\\\")指定参数名称即可 附加:本接口为测试异常接口,一般多个参数会封装为一个入

    2024年02月12日
    浏览(11)
  • spring boot kotlin webflux 或 web 多文件上传 报错400 415 No primary or single unique constructor found for

    spring boot kotlin webflux 或 web 多文件上传 报错400 415 No primary or single unique constructor found for

    #当我们使用Kotlin编写Spring Boot进行多文件上传的时候,传统的方法如下: 此时会有如下几种情况: 以上是第一种情况,直接报错,并提示无主构造函数。这时我们通过互联网搜索可能会在形参上加上: @RequestParam (web)或者 @RequestPart (webflux)。如下: 然后后端没报错了,返回值

    2024年02月15日
    浏览(14)
  • 【unity细节】Default constructor not found for type Player(找不到默认构造函数)

    【unity细节】Default constructor not found for type Player(找不到默认构造函数)

    👨‍💻个人主页 :@元宇宙-秩沅 hallo 欢迎 点赞👍 收藏⭐ 留言📝 加关注✅! 本文由 秩沅 原创 收录于专栏 :unity细节和bug : Default constructor not found for type Player System.RuntimeType.CreateInstanceMono (System.Boolean nonPublic, System.Boolean wrapExceptions) (at 88e4733ac7bc4ae1b496735e6b83bbd3:0) System.Runt

    2024年02月10日
    浏览(10)
  • java.lang.UnsatisfiedLinkError: No implementation found for

    由于native方法修改了包名,导致load so执行的时候崩溃原因分析; 1)确认报错的方法有没有被混淆。         查看混淆 文件是否有下面的配置:                 //保留native方法的类名和方法名                 -keepclasseswithmembernames class * {            

    2023年04月23日
    浏览(10)
  • C#12中的Primary Constructors(主构造函数)

    什么是主构造函数 把参数添加到class与record的类声明中就是主构造函数。例如 这种写法与以下代码写法一样 需要注意的是,类的所有其他构造函数都必须通过 this() 构造函数调用直接或间接调用主构造函数。 主构造函数参数的最常见用途包括但不限于以下几个方面: 初始化

    2024年02月05日
    浏览(8)
  • android studio调用so出现 java.lang.UnsatisfiedLinkError: No implementation found for int

    android studio调用so出现 java.lang.UnsatisfiedLinkError: No implementation found for int

    出现  java.lang.UnsatisfiedLinkError: No implementation found for int, 如果文件都已准备就绪,还出现这样的异常很有可能 是因为 调用这个so的java程序的包名与so包名不一至导致。 注意,这里的java程序的包名并不是 androidmainfest.xml里的包名,而是单纯调用这个so库的这个java文件的包名。

    2024年01月18日
    浏览(9)
  • 【Default config not found for ApplicationConfig】的一种解决方案

    【Default config not found for ApplicationConfig】的一种解决方案

                                                                             💧 记录一下今天遇到的 b u g color{#FF1493}{记录一下今天遇到的bug} 记录一下今天遇到的 b ug 💧           🌷 仰望天空,妳我亦是行人.✨ 🦄 个人主页——微风撞

    2024年02月16日
    浏览(9)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包