Spring+Mybatis框架整合时,根据条件查询数据,发生异常
Caused by: org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'sname' in 'class java.lang.String'
userinfoMapper.xml文件:
<select id="findAll" 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);