错误提示:
严重: 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>