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沒有改過來,是以找不到配置檔案。