mybatis报错:Invalid bound statement (not found):

错误提示:

严重: Servlet.service() for servlet [springmvcServlet] in context with path [] threw exception [Request processing failed; nested exception is org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.xxx.mapper.EmployeeMapper.selectByPrimaryKey] with root cause

org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.xxx.mapper.EmployeeMapper.selectByPrimaryKey

问题所在mybatis中的xxxMapper.xml 文件因为在src/main/java 下,所以无法识别 ;需在pom.xml文件中添加如下代码

注: 只配置单个src/main/java 或者 src/main/resources,将报错:No mapping found for HTTP request with URI

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

猜你喜欢

转载自blog.csdn.net/StarryaSky/article/details/81329068