Mybatis报错:There is no getter for property named * in class**

完整异常

org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter for property named '***' in 'class *****

问题原因

1、参数拼写错误,

例如类中是你SQL中却写成了,就是大小写D的问题

解决方法:改成一样的就行

2、类中根本没这个字段,你SQL中却用到了

解决方法:加上对应字段

3、如果是单个参数传参,可能会获取不到getter方法

解决方法:提前在方法中定义参数。

如你传的是一个String类型参数 s,提前在方法中加上@Param注解

public void test(@Param(value="s") String s){}

猜你喜欢

转载自blog.csdn.net/weixin_42559574/article/details/108752151
今日推荐