Spring+mybatis错误

Spring+mybatis错误:org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding

1
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.BindingException: Parameter 'username' not found. Available parameters are [1, 0, param1, param2]

经测试应该是忘了使用@Param。当只有一个参数时,Mapper中可以不使用

1
2
3
4
public interface LoginDao {
//这里一定要注意 两个以上参数时绑定使用@Param来绑定参数
Role loginIn(@Param("username") String username, @Param("password") String password);
}
赏个🍗吧
0%