错误的意思是: "可选的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. P3379 【模板】最近公共祖先(LCA)(倍增)

    这题有毒!!!!!!!!!! TM我重新打的板子,然而...... 5分钟打完 debug两小时 我的写法常数太大了 每次DFS都要For去更新F 最后写了快读才A 改: 只处理f[i][0] dfs ...

  2. UDP可靠传输简易设计

    UDP,鉴于其丢包和乱序(后发先至)问题,为保证其可靠性设计如下报头协议,供大家参考 数据包设计 数据包总大小按照MTU设计设置,小于1500字节 数据包示意图 包头类型说明 1.类型(1字节) 数值 ...

  3. ELK系列(5) - Logstash怎么分割字符串并添加新的字段到Elasticsearch

    问题 有时候我们想要在Logstash里对收集到的日志等信息进行分割,并且将分割后的字符作为新的字符来index到Elasticsearch里.假定需求如下: Logstash收集到的日志字段mess ...

  4. 使用JMeter进行API功能测试

    使用JMeter进行API功能测试 Apache JMeter是一种流行的开源软件,用于性能测试. 在本博客中,我们将阐明如何使用JMeter for REST API自动化进行功能测试. 我们使用了 ...

  5. (反NIM)

    题目大意是和普通的NIM游戏一样,但是却是取到最后一个是输的,天真的以为就是反过来,其实并不是这样的 结论 先手必胜的条件为 ①:所有堆的石子数均=1,且有偶数堆. ②:至少有一个堆的石子数>1 ...

  6. Codeforces Round #363 (Div. 2) B

    Description You are given a description of a depot. It is a rectangular checkered field of n × m siz ...

  7. 统计分析: 跨库多表join

    mysql中如果多个库在一个实例上, 可以进行多表的跨库Join, 但是如果后期数据库分隔到不同的实例机器上,有查询问题 mysql的查询优化器没有其他商业数据库做的好, 用来CRUD还行, 但是做大 ...

  8. (转)Linux命令详解-file

    Linux命令详解-file 原文:https://www.cnblogs.com/Dodge/p/4278306.html file命令用来识别文件类型,也可用来辨别一些文件的编码格式.它是通过查看 ...

  9. SQL2008无法启动,报错"17051"解决方法

    SQL2008无法启动,这是错误日志: C:/Program Files/Microsoft SQL Server/MSSQL10_50.MSSQLSERVER/MSSQL/Log 2011-06-0 ...

  10. 是时候搞清楚 Spring Boot 的配置文件 application.properties 了!

    在 Spring Boot 中,配置文件有两种不同的格式,一个是 properties ,另一个是 yaml . 虽然 properties 文件比较常见,但是相对于 properties 而言,ya ...