这样使用可能出现
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.xxx报错
解决方法
一.
1.接口和mapper.xml放置同一目录
2.使用maven
打包时*Mapper.xml没有自动复制到class输出目录的mapper类包下
pom.xml添加如下配置
<!-- maven默认不编译xml文件-->
<build>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
<!--默认是true-->
<!--<filtering>true</filtering>-->
</resource>
</resources>
</build>
二. 方法二
1.resources下新建 com/ljc/dao
(这个就是java的dao路径)
注意新建的时候要输入是/不是. com/ljc/dao
然后吧mapper.xml粘贴过去
就可以呢
总结:
编译生成的target文件下出现xml即可映射成功