解决mapper绑定异常:nested exception is org.apache.ibatis.binding.BindingException:

 2023-02-25    281  

原因:

解决mapper绑定异常:nested exception is org.apache.ibatis.binding.BindingException:

此异常的原因是由于mapper接口编译后在同一个目录下没有找到mapper映射文件而出现的。由于maven工程在默认情况下src/main/java目录下的mapper文件是不发布到target目录下的。

解决办法:需要在你的xxxx项目的pom文件中添加一下配置

<!– 如果不添加此节点mapper.xml文件都会被漏掉。 –>

     <build>

          <resources>

            <resource>

                <directory>src/main/java</directory>

                <includes>

                    <include>**/*.properties</include>

                    <include>**/*.xml</include>

                </includes>

                <filtering>false</filtering>

            </resource>

        </resources>

     </build>

以上所述是小编给大家介绍的解决mapper绑定异常:nested exception is org.apache.ibatis.binding.BindingException:,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对77isp云服务器技术网的支持!

原文链接:https://77isp.com/post/34330.html

=========================================

https://77isp.com/ 为 “云服务器技术网” 唯一官方服务平台,请勿相信其他任何渠道。