错误信息片段:
ERROR 35188 --- [nio-8090-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.example.usermanage.mapper.UserMapper.listAll] with root cause
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.example.usermanage.mapper.UserMapper.listAll at org.apache.ibatis.binding.MapperMethod
这是一个关于MyBatis的异常。错误信息表明在尝试执行名为com.example.usermanage.mapper.UserMapper.listAll的语句时,发生了绑定异常。
( ↑ 这个是我们自己创建的包的路径,其中listAll是方法名)
可能的原因和解决方法包括:
检查Mapper XML文件或Mapper接口: 确保在com.example.usermanage.mapper.UserMapper接口对应的XML文件或接口方法中存在名为listAll的SQL映射。在XML文件中应该有一个类似
此处我的UserMapper中定义的是listAll方法:
但当时UserMapper的XML文件中,id没有设为listAll,所以连接不到此方法。
解决方法:改为
参考文章
发表评论