发布时间:2025-01-07 19:01
报错原因:
Cause: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: java.io.IOException: Could not find resource db.properties
java java.io.IOException: Could not find resource mybatis-config.xm
出现问题分析
这个错误说明程序运行行无法找到你所配置的**.xml 或者**.properties 配置文件无法编译。
问题确认:查看一下target/classes下是否有你的配置文件
如果没有–>解决方法:在项目的pom.xml导入如下代码:
<build>
<resources>
<resource>
<directory>src/main/resourcesdirectory>
<includes>
<include>**/*.propertiesinclude>
<include>**/*.xmlinclude>
includes>
<filtering>truefiltering>
resource>
<resource>
<directory>src/main/javadirectory>
<includes>
<include>**/*.propertiesinclude>
<include>**/*.xmlinclude>
includes>
<filtering>truefiltering>
resource>
resources>
build>
这是在添加程序运行时扫描文件范围,这样你的配置文件就能找到!