問題解決:org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):

 

環境:springboot+ mybatis +mysql

原來項目是oracle 我重構項目,改了很多包名,替換了很多類之後,項目終於能啓動了,但只要一訪問數據庫就會報如下的錯誤

2019-11-14 14:35:33.737 ERROR 20684 --- [nio-8888-exec-4] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception

org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.love.frame.user.mapper.SysUserLoginMapper.selectByUserName
    at org.apache.ibatis.binding.MapperMethod$SqlCommand.<init>(MapperMethod.java:227) ~[mybatis-3.4.6.jar:3.4.6]
    at org.apache.ibatis.binding.MapperMethod.<init>(MapperMethod.java:49) ~[mybatis-3.4.6.jar:3.4.6]
    at org.apache.ibatis.binding.MapperProxy.cachedMapperMethod(MapperProxy.java:65) ~[mybatis-3.4.6.jar:3.4.6]
    at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:58) ~[mybatis-3.4.6.jar:3.4.6]
    at com.sun.proxy.$Proxy92.selectByUserName(Unknown Source) ~[na:na]

原因不是代碼寫的對不上,而是mapper 沒有被spring找到。

我已經修改了我的yml,但是卻忘了修改我文件夾裏的名字。

解決辦法:

進到文件夾裏面,把文件名改了。改成和yml裏對的上的。即可解決。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章