出错日志:
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.wisedu.dao.ProductDao.getProduct
文件部署:
mybatis.mapper-locations=classpath:com/wisedu/mapper/*.xml
mybatis.type-aliases-package=com.wisedu.pojo
问题原因:
target文件中没有找到mapper包的编译结果,就是说我的mapper文件根本没有编译。
问题解决:
1.在pom文件中添加如下内容:
-
<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>
2.在网上也看到其他的做法:将mapper.xml文件放到resource下管理