环境: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里对的上的。即可解决。