关于mapper接口与mapper.xml文件在同包运行找不到问题解决
springboot中解决方案一:
将mapper映射文件放到resources下,必须与mapper接口相同结构,并且在主启动类添加@MapperScan("com.offcn.mapper")注解扫描包
解决方案二:
直接在pom.xml中配置插件
<!--将java目录下的.xml/.properties文件复制到resources目录下-->
<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>