Mybatis

Published: by Creative Commons Licence

  • Tags:

踩坑

BindingException

异常具体信息:

org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)

原因,maven默认只会打包resource下的配置文件,因此如果你的mapper.xml文件放在类包下,那么不会被打包到jar文件中。

解决方法,在pom.xml文件中加入:

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