本文主要是介绍解决Parameter 'username' not found. Available parameters are [0, 1, param1, param2],希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
问题描述
2020-03-24 11:04:56.964 ERROR 11092 --- [nio-8092-exec-3] o.a.c.c.C.[.[.[.[dispatcherServlet] :
Servlet.service() for servlet [dispatcherServlet] in context with path [/shop] threw exception [Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.BindingException: Parameter 'username' not found. Available parameters are [0, 1, param1, param2]] with root cause
Mybatis传递参数是按位置传递的,也就是说Dao层的接口中需要这样写:
Books login(@Param("username")String username, @Param("password")String password);
对应的XML中使用参数是这样的
select * from employeewhere name = #{username} and password = #{password}
这篇关于解决Parameter 'username' not found. Available parameters are [0, 1, param1, param2]的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!