Invalid bound statement (not found): indi.marcus.demo.mapper.BookMapper.addBook 错误

我在这里遇到这个问题的原因是:在用IDEA并使用Mybatis的时候,mapper.xml文件没有编译到应用服务器,在maven编译时并没有把这个mapper.xml文件编译到服务器中,所以就会报invalid bound statement (not found)错误,如下图:
在这里插入图片描述
需要在pom文件中加入以下代码,
添加在< build > </ build >中

<resources>
    <resource>
        <directory>src/main/resources</directory>
    </resource>
    <resource>
        <directory>src/main/java</directory>
        <includes>
            <include>**/*.properties</include>
            <include>**/*.xml</include>
        </includes>
        <!-- 是否替换资源中的属性-->
        <filtering>false</filtering>
    </resource>
</resources>

猜你喜欢

转载自blog.csdn.net/qq_37559253/article/details/89527889
今日推荐