org.apache.ibatis.binding.bindingexception: invalid bound statement (not found: com.xx..mapper.xxMapper.xx

dao层编译后只有class文件,没有mapper.xml,因为maven工程在默认情况下src/main/java目录下的所有资源文件是不发布到target目录下的

我的mapper.xml不在resource下面

1.pom.xml:在依赖下面添加

<build>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>com/xiu/record/**/mapper/*.xml</include>
</includes>
<filtering>false</filtering>
</resource>
</resources>
</build>

 

 

2.application加上:
mapper-locations: classpath:com/xiu/record/**/mapper/*.xml
mybatis:
# configuration:
# map-underscore-to-camel-case: true #开启驼峰命名
mapper-locations: classpath:com/xiu/record/**/mapper/*.xml
# type-aliases-package: com.xiu.record.customer.model;
config-location: classpath:/mybatis/mybatis-config.xml


posted @ 2021-12-14 10:09  创嗨  阅读(265)  评论(0编辑  收藏  举报