찾다

 >  Q&A  >  본문

mybatis 错误,找不到mapper?

这是mybatis-config.xml:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
    <environments default="development">
        <environment id="development">
            <transactionManager type="JDBC"/>
            <dataSource type="POOLED">
                <property name="driver" value="com.mysql.jdbc.Driver"/>
                <property name="url"
                          value="jdbc:mysql://localhost:3306/jupan_mail?useUnicode=true&amp;characterEncoding=UTF-8&amp;"/>
                <property name="username" value="root"/>
                <property name="password" value="password"/>
            </dataSource>
        </environment>
    </environments>
    <mappers>
        <mapper resource="com/salamander/backcal/mapping/MailChangeMapper.xml"/>
    </mappers>
</configuration>

这是项目结构:

892670031-581ee02140c15_articlex.png

单元测试报错:Cause: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: java.io.IOException: Could not find resource com/salamander/backcal/dao/MailChangeMapper.xml

高洛峰高洛峰2930일 전474

모든 응답(1)나는 대답할 것이다

  • 三叔

    三叔2016-11-07 10:50:36

    将非java文件移至resources目录中。

    회신하다
    0
  • 취소회신하다