1. 程式人生 > >mybatis(plus) 繼承子模組的 Mapper檔案

mybatis(plus) 繼承子模組的 Mapper檔案

問題的起因是因為在搭建 spring-booot、mybatis-plus、的 maven 多模組專案時,丟擲了異常

Caused by: org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): xxxx

異常的資訊是說,dao介面在繫結mapper.xml檔案時,沒有繫結上,mapper.xml不存在,出現這個問題的原因是因為mapper檔案放在了子模組中,專案沒有去掃描子模組的mapper目錄,最後導致丟擲了異常

之前的mapper 檔案位置設這樣設定的

mapper-locations: classpath:mapper/*.xml

改成

mapper-locations: classpath*:mapper/*.xml