ssm中Invalid bound statement (not found)错误的处理(IDEA中)
来源:互联网 发布:如何消除身体疲劳知乎 编辑:程序博客网 时间:2024/06/05 17:04
根据提示发现if (ms == null) {
throw new BindingException("Invalid bound statement (not found): " + statementName);
}
说明是ms==null导致的,而ms的定义为:MappedStatement ms = null;
也就是没有初始化Statement,如果spring和mybatis配置没问题,那就是mapper.xml和mapper.java没映射成功,
先看一下namespace是否对应,这些都没错的话,那应该就是文件加载的问题
src下的.xml没有加进来
解决办法:
1)将.xml放进resources中,同时在spring和mybatis整合文件中加入<property name="mapperLocations" value="classpath:mapper/*.xml"/>
,位置如下:
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"> <property name="dataSource" ref="dataSource" /> <property name="mapperLocations" value="classpath:mapper/*.xml"/> </bean>
2)如果想遵循mapper.xml和mapper.java在同一文件中,而且使用的是maven,可以在maven配置文件中配置(在<build>
标签中加入如下配置):
<build> <resources> <resource> <directory>src/main/java</directory> <includes> <include>**/*.xml</include> </includes> </resource> </resources> </build>
src/main/java这个是资源文件路经,*/.xml要打包的文件类型
注意:第二种方法中不要再加第一种中的配置,否则还是会报错.
阅读全文
0 0
- ssm中Invalid bound statement (not found)错误的处理(IDEA中)
- Mybatis - 在idea中错误:Invalid bound statement (not found)
- Mybatis在idea中错误:Invalid bound statement (not found)
- Mybatis在idea中错误:Invalid bound statement (not found)
- Mybatis在idea中错误:Invalid bound statement (not found)
- Invalid bound statement (not found)-Mybatis在idea中错误
- IDEA中 Invalid bound statement (not found)解决方法
- 新版IntelliJ IDEA中Mybatis报Invalid bound statement (not found)错误解决办法
- IDEA中Spring Boot项目MyBaits提示Invalid bound statement (not found)错误
- IntelliJ IDEA中Mybatis报Invalid bound statement (not found)错误解决办法
- IDEA中Spring Boot项目MyBaits提示Invalid bound statement (not found)错误
- 关于IDEA工具在springboot整合mybatis中出现的Invalid bound statement (not found)问题
- ssm出现Invalid bound statement (not found):
- 【mybatis】【idea】【maven】Invalid bound statement (not found)的解决
- mybatis错误: Invalid bound statement (not found)
- mybatis错误:Invalid bound statement (not found)
- mybatis错误:Invalid bound statement (not found)
- mybatis错误:Invalid bound statement (not found)
- codeforce834A
- 时间和时间戳之间的转换
- 从小到大排序1(for循环法)
- leetcode:path-sum
- Play 2.0 中文资料
- ssm中Invalid bound statement (not found)错误的处理(IDEA中)
- Codeforces Round #426 (Div. 2) C. The Meaningless Game
- 调试代码时免重复输入数据
- 面试题:替换空格
- Zookeeper client
- FileChannel 传输(zero-copy 的基础)
- word-break:break-all和word-wrap:break-word的区别
- C# windows服务没有RunInstallerAttribute.Yes的公共安装程序
- Spring Security 与 Oauth2 整合 步骤