xml文件放在resources下
- 看下我的项目目录

2.由于放在resurces下就无法扫描到xml文件,所以就需要在配置文件配置
| --mapper文件位置 |
| mybatis.mapper-locations=classpath:mapper/*.xml |
| 或 |
| mybatis.mapper-locations=classpath:/mapper/*.xml |
xml和mapper文件放在一起
- 我的项目目录

- 但是这样会造成xml文件的打包问题

- 需要.pom文件需要加入指定打包目录
| |
| <build> |
| <resources> |
| <resource> |
| <directory>src/main/java</directory> |
| <includes> |
| <include>**/*.xml</include> |
| </includes> |
| <filtering>false</filtering> |
| </resource> |
| <resource> |
| <directory>src/main/resources</directory> |
| </resource> |
| </resources> |
| </build> |

最后在整合的过程中可能会出现Springboot版本的冲突问题
| <?xml version="1.0" encoding="UTF-8"?> |
| <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> |
| |
| <parent> |
| <artifactId>com.john.xh</artifactId> |
| <groupId>org.example</groupId> |
| <version>1.0-SNAPSHOT</version> |
| </parent> |
| |
| <packaging>war</packaging> |
| |
| <modelVersion>4.0.0</modelVersion> |
| |
| <artifactId>springBoot_web</artifactId> |
| |
| <properties> |
| <maven.compiler.source>8</maven.compiler.source> |
| <maven.compiler.target>8</maven.compiler.target> |
| </properties> |
| |
| <dependencies> |
| |
| <dependency> |
| <groupId>org.springframework.boot</groupId> |
| <artifactId>spring-boot-starter-web</artifactId> |
| <version>2.6.2</version> |
| </dependency> |
| |
| <dependency> |
| <groupId>org.mybatis.spring.boot</groupId> |
| <artifactId>mybatis-spring-boot-starter</artifactId> |
| <version>2.2.2</version> |
| </dependency> |
| |
| <dependency> |
| <groupId>mysql</groupId> |
| <artifactId>mysql-connector-java</artifactId> |
| <version>8.0.23</version> |
| </dependency> |
| |
| <dependency> |
| <groupId>com.alibaba</groupId> |
| <artifactId>druid</artifactId> |
| <version>1.1.6</version> |
| </dependency> |
| </dependencies> |
| |
| |
| <build> |
| <resources> |
| <resource> |
| <directory>src/main/java</directory> |
| <includes> |
| <include>**/*.xml</include> |
| </includes> |
| <filtering>false</filtering> |
| </resource> |
| <resource> |
| <directory>src/main/resources</directory> |
| </resource> |
| </resources> |
| </build> |
| </project> |
| |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· AI 智能体引爆开源社区「GitHub 热点速览」
· 从HTTP原因短语缺失研究HTTP/2和HTTP/3的设计差异
· 三行代码完成国际化适配,妙~啊~