java.lang.IllegalStateException: Optional int parameter 'currentSpecialIndex' is present but cannot
来源:互联网 发布:淘宝卖家后台功能介绍 编辑:程序博客网 时间:2024/06/16 20:38
java.lang.IllegalStateException: Optional int parameter 'currentSpecialIndex' 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.
spring mvc 封装参数猜想
1. 如果用对象来接受参数 spring 会首先new 一个对象出来然后将传过来的匹配到属性的值赋给属性。
2. 如果在方法中直接写变量来接受前台的参数 如果匹配到变量则赋值 如果前台没有对应变量的参数spring会给该变量一个null 值而不是改变量类型的默认值。
public Knowledge findVideoBySpecialId(int specialId,int currentPage)
以上问题是因为我定义了一个int类型的变量来接受参数传入但是前台并没有传入该参数所以sping给一个null 但是null并不能赋值给int 所以引发异常 可以考虑用string 类型或者将参数封装为对象 或者用该类型的包装类型。
—待验证啊。。。。
0 0
- java.lang.IllegalStateException: Optional int parameter 'currentSpecialIndex' is present but cannot
- java.lang.IllegalStateException: Optional int parameter 'pageSize' is present but cannot be translat
- Optional int parameter 'folderId' is not present but cannot be translated into a null value due to b
- Optional int parameter 'id' is present but cannot be translated into a null value due to being decla
- Optional int parameter 'page' is present but cannot be translated into a null value due to being dec
- Optional int parameter 'version' is present but cannot be translated into a null value due to being
- Optional int parameter 'id' is present but cannot be translated into a null value due to being decla
- Optional int parameter 'rip' is present but cannot be translated into a null value due to being decl
- Optional int parameter 'topicId' is present but cannot be translated into a null value due to being
- Optional int parameter 'id' is present but cannot be translated into a null value due to being decla
- Optional int parameter 'pageNumber' is present but cannot be translated into a null value due to bei
- Required int[] parameter 'ids' is not present
- nested exception is java.lang.IllegalStateException: Ambiguous mapping. Cannot map ***
- nested exception is java.lang.IllegalStateException: Cannot convert value of type [org.springframewo
- 使用RecyclerView中引发 java.lang.IllegalStateException: Cannot call this method while RecyclerView is com
- mybatis 异常处理Cause: java.lang.IllegalStateException: Cannot enable lazy loading because CGLIB is not
- java.lang.IllegalStateException: Cannot map handler
- Java.lang.IllegalStateException: Ambiguous mapping found. Cannot
- (4.2.18)ViewPagerIndicator框架使用——CirclePageIndicator
- NYOJ--91--阶乘之和
- BMW BENZ AUDI 宝马,奔驰,奥迪维修标准工时,从KSD,WIS, ELSA 中提取。
- 逻辑Bug:在使用递归时的返回问题
- java多线程(一)
- java.lang.IllegalStateException: Optional int parameter 'currentSpecialIndex' is present but cannot
- Java Web基础——自定义标签和JSTL
- 【姿势】Android 和 Mac 爆毁灭级安全漏洞
- enum Size
- C#集合类型
- iOS将汉字转换为拼音
- UITableVIew 滚动流畅性优化
- hdu1556 Color the ball(线段树区间更新)
- 112. Path Sum