spring boot 集成mybatis的時候出現瞭如下錯誤:
Invalid bound statement (not found)
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):XXXXXXXXXXXXXXX
........................................
Caused by: org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): XXXXXXXXXXXXXXXXXXXXXXXXX
at org.apache.ibatis.binding.MapperMethod$SqlCommand.<init>(MapperMethod.java:225)
出錯的原因是沒有找到配置文件。
可能的原因是:
1.spring boot的application.properties配置文件中mybatis.config-locations及mybatis.mapper-locations的值配置錯了。
2.本身的Mapper文件錯了。
我檢查了下自己的程序,發現是我自己的配置文件錯了。接口文件原名爲XXXDao,後來爲了規範改爲IXXXDao,但是配置文件<resultMap>中屬性值type沒有改過來,所以找不到配置文件。