Spring+Mybatis框架整合时,根据条件查询数据,发生异常
Caused by: : There is no getter for property named 'sname' in 'class '
文件:
<select parameterType="string" resultMap="userinfoMap">
select * from userinfo where sname like '%${sname}%'
</select>
UserinfoMapper接口:
public List<Userinfo> findAll(String sname);
解决方法:在参数前加@Param标签
public List<Userinfo> findAll(@Param("sname") String sname);