Optional int parameter ‘xxx‘ is present but cannot be translated into a null value due to being decl

本文详细记录了一次由于前端currpage字段与后端currPage字段大小写不一致导致的错误,错误表现为Optionalintparameter无法转换为null值。解决方案是将后端参数声明为对象包装类,以允许null值。通过这个案例,我们了解到前后端字段一致性的重要性以及如何处理这种常见问题。
摘要由CSDN通过智能技术生成

错误描述:

processing failed; nested exception is java.lang.IllegalStateException: Optional int parameter ‘currPage’ is present but cannot be translated into a null value due to being declared as a primitive type. Consider declaring it as object wrapper for the corresponding primitive type.
java.lang.IllegalStateException: Optional int parameter ‘currPage’ is present but cannot be translated into a null value due to being declared as a primitive type. Consider declaring it as object wrapper for the corresponding primitive type.

在这里插入图片描述

错误原因:

前后端字段名不一致前端为currpage,后端为currPage
在这里插入图片描述在这里插入图片描述

在这里插入图片描述

修改后

在这里插入图片描述

总结:

一般Optional int parameter ‘xxx’ is present but cannot be translated into a null value due to being declared as a primitive type. 种错误的原因为前后端字段名不一致

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值