Invalid bound statement (not found)

栏目: Java · 发布时间: 5年前

内容简介:搞Mybatis的时候出现一个错,报错信息如题.主要是映射文件加载的问题.假如java文件夹中跟resources文件夹中的目录是一一对应,也就是下面这样

搞Mybatis的时候出现一个错,报错信息如题.

主要是映射文件加载的问题.

假如 java 文件夹中跟resources文件夹中的目录是一一对应,也就是下面这样

main java com swifter mapper UserMapper.java
resources com swifter mapper UserMapper.xml

上面这样的实际目录结构(在文件夹中)是不会有问题的,java文件跟xml文件会打包到同一个目录下,如下图

Invalid bound statement (not found)

但是通过idea在resources中创建的实际目录结构是下面这样┑( ̄Д  ̄)┍

main java com swifter mapper UserMapper.java
java com.swifter.mapper UserMapper.xml

打包之后实际目录结构如下图,xml文件被打包到一个名叫com.swifter.mapper的文件夹,这就导致xml文件找不到.

Invalid bound statement (not found)

解决方法:

  1. 实际文件夹中创建文件结构
  2. java跟xml文件放到同一个文件夹,然后在pom.xml中添加如下内容:
<build>
        <!-- 这个元素描述了项目相关的所有资源路径列表,例如和项目相关的属性文件,这些资源被包含在最终的打包文件里。 -->
        <resources>
            <resource>
                <!-- 描述存放资源的目录,该路径相对POM路径 -->
                <directory>src/main/java</directory>
                <includes>
                    <include>**/*.xml</include>
                </includes>
            </resource>
        </resources>
    </build>

--EOF--


以上所述就是小编给大家介绍的《Invalid bound statement (not found)》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

The Little Typer

The Little Typer

Daniel P. Friedman、David Thrane Christiansen、Duane Bibby、Robert Harper、Conor Mcbride / MIT Press / 2018-10-16 / GBP 30.00

An introduction to dependent types, demonstrating the most beautiful aspects, one step at a time. A program's type describes its behavior. Dependent types are a first-class part of a language, and are......一起来看看 《The Little Typer》 这本书的介绍吧!

JSON 在线解析
JSON 在线解析

在线 JSON 格式化工具

HTML 编码/解码
HTML 编码/解码

HTML 编码/解码

URL 编码/解码
URL 编码/解码

URL 编码/解码