mybatis入参错误:There is no getter for property named ‘status‘ in ‘class java.lang.Integer‘

前因后果
今天做一个查询功能遇到一个Mybatis的反射异常,报这个错我还是觉得蛮奇怪的,具体情况就是单个入参在String类型下不报错,在Integer类型的情况下居然报一个反射异常:
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter for property named ‘status’ in ‘class java.lang.Integer’…后面省略N行报错信息。

查询报错,参数写法如下:

List<demo> findLst(Integer status);

解决方法:在参数上加@Param注解:

List<demo> findLst(@Param("status") Integer status);

需要知道具体原因的可看下Mybatis源代码了解一下。

原文地址:https://www.cnblogs.com/javakfz/p/13938243.html