错误的意思是: "可选的int参数'fundID'存在但由于被声明为基本类型而无法转换为空值"

意思是fundID被申明为int的基本数据类型, 不能转换为字符串的null值. 难道是在参数调用

的时候, 需要把fundID设置为对象类型吗? 答案是正确的.

    @RequestMapping(value = "/fund-purchase")
public String fundPurchase(int fundID) {
Fund fund = fundService.selectFundByID(1);
System.out.println("fund: " + fund);
return null;
}

解决办法: int 改为 Integer,

前端通过url传递过来的数据, 改为对象类型

    @RequestMapping(value = "/fund-purchase")
public String fundPurchase(Integer fundID) {
Fund fund = fundService.selectFundByID(1);
System.out.println("fund: " + fund);
return null;
}

问题解决!

Optional int parameter 'fundID' is present but cannot be translated into a null value due to being declared as a primitive type的更多相关文章

  1. Optional int parameter 'pId' is present but cannot be translated into a null value due to being declared as a primitive type.

    接口测试的时候遇到了一个问题,导致测试阻断了好久,在此记录,谨防忘记. 具体报错如下: Optional int parameter 'pId' is present but cannot be tr ...

  2. is present but cannot be translated into a null value due to being declared as a primitive type

    解决办法:把基本类型改为对象,譬如此处将pageId的类型由int 改为Integer 2016-10-19 19:36:11.275 DEBUG [http-nio-9999-exec-2][org ...

  3. Optional int parameter 'time' is present but cannot be translated into a null value due to being decla

    今天在操作redis的时候报了这个错:Optional int parameter 'time' is present but cannot be translated into a null val ...

  4. Optional int parameter 'rows' is not present but cannot be translated into a null value due to being declared as a primitive type.

    我的spring mvc 代码: @Controller @RequestMapping("/product") public class Fancy { @RequestMapp ...

  5. Optional int parameter 'id' is present but cannot be translated into a null value due to being decla

    这个错误可以将参数由int改为Integer

  6. Optional int parameter 'resourceState' is present but cannot be translated into a null value

    错误日志: java.lang.IllegalStateException: Optional int parameter 'resourceState' is present but cannot ...

  7. Tomcat上java.lang.IllegalStateException: Optional int parameter 'id' is not present

    今日, 本人在tomcat+spring mvc平台的服务器上遇到java.lang.IllegalStateException: Optional int parameter 'id' is not ...

  8. Required String parameter ' ' is not present

    Required String parameter ' ' is not present 报错原因: url中的参数错误. 解决方法: 1.修正url中的参数的值. 2.在Controller层中的@ ...

  9. 使用springmvc报错Required int parameter 'age' is not present

    仔细检查jsp代码 <a href="springmvc/testRequestParam?username=atguigu$age=11">Test RequestP ...

随机推荐

  1. Objective-C的Runtime System

    [0] Outline --  [1] 版本和平台 --  [2] 与Runtime System交互 --  [3] 方法的动态决议 --  [4] 消息转发 --  [5] 类型编码 --  [6 ...

  2. c语言中malloc函数的使用

    传送门:https://www.cnblogs.com/shiweihappy/p/4246372.html c语言中内存的管理:https://www.cnblogs.com/tuhooo/p/72 ...

  3. Shell面试,笔试整理

    1.经典Shell脚本面试问题:https://blog.csdn.net/hyszyl/article/details/60970307

  4. Vue中全局导入和按需导入的区别

    export {router} //按需导出 import {router} from './router' //按需导入路由模块 export default //全局导出store模块 store ...

  5. Linux--2 Linux之文档与目录结构、shell基本命令

    一.Linux之文档与目录结构 1.Linux之文档与目录结构 Linux目录结构的组织形式和Windows有很大的不同.Linux没有“盘(如C盘.D盘.E盘)”的概念,而是建立一个根"/ ...

  6. 浅谈ThreadLocal模式

    一.前言: ThreadLocal模式,严格意义上不是一种设计模式,而是java中解决多线程数据共享问题的一个方案.ThreadLocal类是java JDK中提供的一个类,用来解决线程安全问题,并不 ...

  7. Win10创建还原点

    Win + E打开任务管理器 右击此电脑,选择属性 单击高级系统设置 选择系统保护 单击系统还原 按照提示操作,OK.

  8. (转)Linux系统stat指令用法

    <Linux系统stat指令用法>  原文:https://www.cnblogs.com/linux-super-meng/p/3812695.html stat指令:文件/文件系统的详 ...

  9. python_2开发简单爬虫

    2017年12月03日 16:43:01 独行侠的守望 阅读数:204 标签: python爬虫 更多个人分类: Python编辑版权声明:本文为博主原创文章,转载请注明文章链接. https://b ...

  10. json解析数组类型的数据

    //微信里一个检测是否有发送模版消息的权限的方法//此处的openid代表的微信用户openid,templateId代表的是模版消息idpublic boolean checkIsSendTempM ...