No MyBatis mapper was found in '[com.study.dal.***.mapper]' package
来源:互联网 发布:成都收银软件系统 编辑:程序博客网 时间:2024/06/10 23:54
使用 MapperScannerConfigurer 自动扫描mapper下的文件时,一直出现下面警告: No MyBatis mapper was found in ‘[com.study.boot.dal.*.mapper]’ package.
并且也没有注册mapper的文件
配置如下
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer"> <property name="sqlSessionFactoryBeanName" value="sqlSessionFaction" /> <property name="annotationClass" value="javax.annotation.Resource" /> <property name="basePackage" value="com.study.boot.dal.***.mapper" /> </bean>
原因是: 由于增加了 annotationClass的配置, 导致只会扫描被 Resource 注解的文件,因此只需要把这段配置注释掉就ok
修改之后的配置如下
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer"> <property name="sqlSessionFactoryBeanName" value="sqlSessionFaction" /> <property name="basePackage" value="com.study.boot.dal.***.mapper" /> </bean>
使用annotationClass的源码如下:
protected void registerDefaultFilters() { boolean acceptAllInterfaces = true; // if specified, use the given annotation and / or marker interface if (MapperScannerConfigurer.this.annotationClass != null) { addIncludeFilter(new AnnotationTypeFilter(MapperScannerConfigurer.this.annotationClass)); acceptAllInterfaces = false; } // override AssignableTypeFilter to ignore matches on the actual marker interface if (MapperScannerConfigurer.this.markerInterface != null) { addIncludeFilter(new AssignableTypeFilter(MapperScannerConfigurer.this.markerInterface) { @Override protected boolean matchClassName(String className) { return false; } }); acceptAllInterfaces = false; } if (acceptAllInterfaces) { // default include filter that accepts all classes addIncludeFilter(new TypeFilter() { public boolean match(MetadataReader metadataReader, MetadataReaderFactory metadataReaderFactory) throws IOException { return true; } }); } }
阅读全文
0 0
- No MyBatis mapper was found in '[com.study.dal.***.mapper]' package
- No MyBatis mapper was found in 'XXX' package. Please check your configuration
- No MyBatis mapper was found in '' package. Please check your configura, Could not autowire field
- 解决main No MyBatis mapper was found in 的警告
- MyBatis-Mapper中错误No constructor found...
- No qualifying bean of type [com.jj.mapper.UserMapper] found for dependency
- mybatis+spring boot, mapper 提示Could not autowire. No beans of … type found
- mybatis报错—— Invalid bound statement (not found): com.mapper.EmployeeMapper.updEmp
- Mybatis匹配Mapper报no getter错误
- idea中mybatis+spring boot, mapper 提示Could not autowire. No beans of … type found解决办法
- mybatis中定义mapper 出现bound statement (not found)
- Mybatis - Mapper文件简练
- mybatis Mapper.xml 详解
- MyBatis Mapper 文件例子
- Mybatis学习- Mapper
- mybatis配置mapper注解
- mybatis mapper orderby like
- mybatis mapper.xml
- 变态的素数筛选题 精简到肝胆俱裂 时间<0.2s
- 从零基础认识sql语法
- 计算机网络 学习摘要(3)
- 欢迎使用CSDN-markdown编辑器
- 7-21 PAT排名汇总
- No MyBatis mapper was found in '[com.study.dal.***.mapper]' package
- 【LeetCode】Binary Tree Zigzag Level Order Traversal 二叉树的锯齿形层次遍历
- Rhyme/ 手写服务器 实现一个基于xml解析的简单的Tomcat服务器
- PTA 7-22 模拟EXCEL排序
- python yield 简单理解
- 配置CISCO IOS
- Leetcode 题解系列(七)
- PTA 7-7 Windows消息队列
- Java中Synchronized的用法