idea显示如下错误


配置文件value可以这样写
<property name="mapperLocations" value="com/yi/mapper/Usermapper.xml"/>
另外需要在poxm.xml加上依赖
<build>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
<filtering>false</filtering>切记为false, 是否使用过滤器
</resource>
</resources>
</build>
另外一种方法是把配置文件放到resources下,就可以了
<property name="mapperLocations" value="Usermapper.xml"/>
本文介绍了解决MyBatis中mapper配置错误的方法,包括正确配置mapperLocations属性,以及在pom.xml中添加资源加载配置,确保XML映射文件能够被正确识别。
1万+





