springboot整合mybatis错误 Invalid bound statement (not found): com.yuan.mapper.UserMapper.getUserList

出现的原因是 

src文件下的mapper有mapper接口和映射文件,而target下的mapper文件却没有映射文件

      

===========================解决方案==================================

 1.把映射文件 放到resources 目录下 结构目录一模一样

 2.在pom.xml中导入以下代码

<build>
        <resources>
            <resource>
                <directory>src/main/java</directory>
                <includes>
                    <include>**/*.properties</include>
                    <include>**/*.xml</include>
                </includes>
                <filtering>false</filtering>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
                <includes>
                    <include>**/*.*</include>
                </includes>
                <filtering>false</filtering>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

猜你喜欢

转载自www.cnblogs.com/proyuan/p/11802368.html