springboot中解决方案一:

将mapper映射文件放到resources下,必须与mapper接口相同结构,并且在主启动类添加@MapperScan("com.offcn.mapper")注解扫描包

关于mapper接口与mapper.xml文件在同包运行找不到问题解决

 

 

 关于mapper接口与mapper.xml文件在同包运行找不到问题解决

解决方案二:

直接在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>

 

相关文章:

  • 2021-11-24
  • 2021-08-15
  • 2022-12-23
  • 2021-05-13
  • 2022-12-23
  • 2021-12-16
  • 2022-12-23
  • 2021-12-03
猜你喜欢
  • 2022-12-23
  • 2021-06-18
  • 2021-08-17
  • 2023-01-09
  • 2023-03-19
  • 2022-12-23
  • 2021-07-01
相关资源
相似解决方案