使用Maven构建项目,spring整合mybatis发生错误:Mapped Statements collection does not contain value for
2017-10-09 17:43
1366 查看
问题产生原因:这是因为在使用maven构建项目时,当启动maven的tomcat插件运行项目只会加载src/main/resources目录下的配置文件,并不会去加载放在src/main/java目录下的配置文件,这是导致产生错误:Mapped Statements collection does not contain value for 的根本原因。
解决方法:在配置文件所在的项目下的pom文件中添加以下配置,这样就会扫描到src/main/java目录下的配置文件
<!-- 如果不添加此节点mybatis的mapper.xml文件都会被漏掉。 -->
<build>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
<filtering>false</filtering>
</resource>
</resources>
</build>
解决方法:在配置文件所在的项目下的pom文件中添加以下配置,这样就会扫描到src/main/java目录下的配置文件
<!-- 如果不添加此节点mybatis的mapper.xml文件都会被漏掉。 -->
<build>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
<filtering>false</filtering>
</resource>
</resources>
</build>
相关文章推荐
- Spring整合MyBatis错误:Mapped Statements collection does not contain value for
- spring整合mybatis bug解决java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for ...
- mybatis+springMVC整合出现Mapped Statements collection does not contain value for ***
- IDEA中配置Mybatis报出“Mapped Statements collection does not contain value for”的错误
- mybatis错误 Mapped Statements collection does not contain value for
- mybatis 错误 Mapped Statements collection does not contain value for
- mybatis错误 Mapped Statements collection does not contain value for
- Mapped Statements collection does not contain value for com.yangyun.springmybatis.dao.UsersDao.addUs
- Mapped Statements collection does not contain value for com.mybatis_Spring.dao.getAllUsers
- Mapped Statements collection does not contain value for xxxx mybatis xml maven package install
- mybatis之Mapped Statements collection does not contain value for...错误原因分析
- mybatis错误 Mapped Statements collection does not contain value for
- mybatis错误 Mapped Statements collection does not contain value for
- mybatis错误 Mapped Statements collection does not contain value for
- mybatis+spring MVC启动的时候 4000 出现Mapped Statements collection does not contain value for
- 异常:使用mybatis框架 Mapped Statements collection does not contain value for 后面为类方法
- Mapped Statements collection does not contain value for(mybatis框架项目)
- mybatis错误 Mapped Statements collection does not contain value for
- mybatis之Mapped Statements collection does not contain value for...错误原因分析
- Mybatis项目从Eclipse转入Idea无法启动问题 Mapped Statements collection does not contain value for