ssm项目 报错 org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):

ssm的项目如果在mapper.xml mapper接口 配置没问题的情况下 项目依然报org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)

报错原因:mapper.xml 和 mapper接口绑定失败 , mapper.xml 找不到

解决方法:在pom文件中指定文件加载

<build>
		<!-- 如果不添加此节点mybatis的mapper.xml文件都会被漏掉。 -->
        <resources>
            <resource>
                <directory>src/main/java</directory>
                <includes>
                    <include>**/*.properties</include>
                    <include>**/*.xml</include>
                </includes>
                <filtering>false</filtering>
            </resource>
            <!-- 指明加载resources -->
            <resource>
                <directory>src/main/resources</directory>
                <includes>
                    <include>**/*.properties</include>
                    <include>**/*.xml</include>
                </includes>
                <filtering>false</filtering>
            </resource>
        </resources>
    </build>

猜你喜欢

转载自blog.csdn.net/weixin_42141668/article/details/102822890