Invalid bound statement (not found)错误
都对着,为什么会报这个错呢,mapper也拿到了,为什么查询时出错呢,最后看target里编译的文件发现少了mapping,xml没编译过去。
我的目录结构:dao层都编译过去了,但mapper.xml没有,那就是编译没包含进去

解决方法:pom文件里加上就好了。(然而并没有)
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
</resources>
</build>
好高兴的看到target里有了xml文件,但是启动还是报错了,Caused by: java.io.FileNotFoundException: Could not open ServletContext resource [/classpath*:com/wskt/module/*/dao/mapping/**Mapper.xml]
原因:

这样一个流程调下去,路径没有得到解析,所以找不到,
如果在配置类里就可以:
@Bean
@ConfigurationProperties(prefix = "mybatis-plus")
public SqlSessionFactoryBean sqlSessionFactory() throws IOException {
SqlSessionFactoryBean sqlSessionFactoryBean = new SqlSessionFactoryBean();
sqlSessionFactoryBean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("com/wskt/module/*/dao/mapping/**Mapper.xml"));
sqlSessionFactoryBean.setDataSource(dynamicDataSource());
return sqlSessionFactoryBean;
}
原因找到了,就看怎么指定PathMatchingResourcePatternResolver
Invalid bound statement (not found)错误的更多相关文章
- MyBatis: Invalid bound statement (not found)错误的可能原因
MyBatis: Invalid bound statement (not found)错误的可能原因 其他原因导致此问题解决参考: 1.检查 xml 文件所在 package 名称是否和 Mappe ...
- myBatis中Invalid bound statement (not found)错误
环境:Idea.ssm.maven 由于使用maven的原因,maven不会扫描到mapper的xml文件所以会出现此类问题. 每次走到mapper方法时就抛异常:Invalid bound stat ...
- Invalid bound statement (not found) 错误原因
对我来说,错误的原因是因为没有配置:mybatis.mapperLocations=classpath:mybatis/mapper/*Mapper.xmlmybatis.config-locatio ...
- Mybatis-plus报Invalid bound statement (not found)错误
错误信息 org.springframework.security.authentication.InternalAuthenticationServiceException: Invalid bou ...
- 在使用mybatis的selectFromExample时出现Invalid bound statement (not found)错误
主要原因:运行项目在构建的时候只会默认的去加载resource资源文件里面的资源,其他地方的配置资源不会加载 .故没有读取到mybatis的MapperXml映射 结构如下 ============= ...
- org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)错误几种解决方案
报错信息: org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.study.ser ...
- org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): 错误解决
报错信息:org.apache.ibatis.binding.BindingException: Invalid bound statement (not found) 说明:这段报错信息表示 Map ...
- mybatis Invalid bound statement (not found)错误解决办法
由于新版的IntelliJ IDEA不再编译source folder下的xml文件,而我们平时使用mybatis时,习惯于将*Mapper.xml文件放在与dao层.service层平级的src目录 ...
- 关于 Mybatis 的Invalid bound statement (not found):错误
今天遇到一个特别奇怪的问题,最后发现是自己对mybatis的学习还有待提高 返回类型可以用resultType,也可以用resultMap resultType是直接表示返回类型的,而resultMa ...
- 解决org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)错误
我调这个bug调了一天多,在网上搜索的检查namespace,package等,都没有错.错误提示是没有找到xml文件,我就纳闷了,为什么找不到呢?后来才发现,原来是resource中奇怪的目录为题, ...
随机推荐
- 今天刚到货的小米平板2,就出现dnx fastboot mode一直卡死黑屏
http://bbs.xiaomi.cn/t-11786254 今天刚到货的小米平板2,就出现dnx fastboot mode一直卡死黑屏, 发表在晒机评测2015-11-30 14:22:57 来 ...
- 【转载】Spring boot学习记录(一)-入门篇
前言:本系列文章非本人原创,转自:http://tengj.top/2017/04/24/springboot0/ 正文 首先声明,Spring Boot不是一门新技术.从本质上来说,Spring B ...
- 移动端安全 - 安卓Android - 工具相关
渗透工具 drozer .安装文件解压后文件介绍 setup.exe ---安装 agent.apk ---用于调试 - 安装在安卓手机上 使用命令 . cd 到 drozer 安装目录 . adb ...
- workflow-core 简介
最近想做一个OA相关的网站开发,一直都听说有workflow的东西,之前也断断续续学习过 Workflow Foundation 4.0,还是没有搞明白到底能够用它做什么 但还是觉得workflow在 ...
- csharp - retrieve LDAP
DirectoryEntry de = new DirectoryEntry("LDAP://10.10.10.10:389"); DirectorySearcher search ...
- Java-多线程第一篇多线程相关认识(1)
1.单线程进程 如果程序执行某行代码时遇到了阻塞,则程序将会停滞在该处. 2.进程代表着一个程序,程序是静态的,进程是动态的程序. 进程是系统进行资源分配和调度的一个独立单位.关于进程有如下3个特征: ...
- spring-第七篇之深入理解容器中的bean
1.抽象bean与子bean 用于指定配置模板. 2.容器中的工厂bean 这种工厂bean必须实现FactoryBean接口,通过spring容器getBean()方法获取它时,容器返回的不是Fac ...
- "源文件名长度大于文件系统支持的长度无法删除"的解决方案
import java.io.File; import java.io.IOException; import org.apache.commons.io.FileUtils; /** * @auth ...
- HTTP中ip地址伪造的问题以及解决办法
在真实环境下,php获取客户端ip地址的方法通常有以下几种: (1):通过$_SERVER[ "HTTP_CLIENT_IP" ] (2):通过$_SERVER[ "HT ...
- Codeforces - 1191B - Tokitsukaze and Mahjong - 模拟
https://codeforces.com/contest/1191/problem/B 小心坎张听的情况. #include<bits/stdc++.h> using namespac ...