There is no getter for property named 'userId' in 'class java.lang.String'

时间:2023-03-09 06:05:05
There is no getter for property named 'userId' in 'class java.lang.String'

[ERROR] 2017-01-18 04:37:06:231 cn.dataenergy.common.CenterHandlerExceptionResolver (CenterHandlerExceptionResolver.java:44) - 统一捕获异常: org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'userId' in 'class java.lang.String'

对于这个错误。可能的原因我这里总结一下,如有不足,请及时提醒并更正!

原因1,检查可能出错的bean,如果确实没有个get方法,添加get方法即可解决

原因2,原因1没有问题,可能出错的就是对应的xml文件出错了,一般,当只有一个查询条件时,应当这样写where条件,userId={value},当查询条件有多个的时候,一般我们是把他放到一个*ReqBean里,这个bean里的字段要和xml文件上面的sql-where字段一一对应