mybatis错误:Could not resolve resource location pattern [classpath:com/demon/user/mapper/*.xml]: class

ssm框架下mybatis报错:Could not resolve resource location pattern [classpath:com/demon/user/mapper/*.xml]: class path resource [com/demon/user/mapper/] cannot be resolved to URL because it does not exist

这是因为没有没有加载到mapper.xml文件


解决方法:

在pom.xml文件的<build></build>标签里添加如下代码并重新编译运行:

    <build>
        <finalName>demon</finalName>
        <resources>
            <resource>
                <directory>src/main/java</directory>
                <includes>
                    <include>**/*.xml</include>
                </includes>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
                <includes>
                    <include>*.xml</include>
                </includes>
            </resource>
        </resources>
    </build>

posted @ 2018-03-21 15:17  lozhu  Views(464)  Comments(0Edit  收藏  举报