SpringBoot与Mybatis整合的xxxMapper.java与xxx.Mapper.xml的问题
如果想把二者放在一个文件夹下,不做任何配置的情况会出现错误
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.offcn.mapper.UserMapper.getUserList
解决方案:
1. 把映射文件 放到resources 目录下 结构目录一模一样
2.在pom.xml文件中添加如下
<build>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
<filtering>false</filtering>
</resource>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.*</include>
</includes>
<filtering>false</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>