Comments (7)
应该是你写错了。有可能属于下面的某种情况:
AMapper<A> extends Mapper<A>
或者
AMapper extends Mapper
正确的应该是
AMapper extends Mapper<A>
from mybatis-spring-boot.
刚才把代码搜了一遍,写法和上面说的一致。
我这边的场景是这样的:
这种写法就不报错
package com.sns.schedule;
@SpringBootApplication(scanBasePackages = {"com.sns"})
public class Application{
这样写就报上面的错(之所以这么折腾老代码,是觉得下面的写法优雅):
package com.sns;
@SpringBootApplication
public class Application{
from mybatis-spring-boot.
还有一种可能就是你扫描到基类接口了。这类接口没有指定泛型,不能被扫描。
from mybatis-spring-boot.
老代码比较早,当时还没有通用mapper的autoconfig,
通用mapper的的MyMapper.java在“com.sns.data”下,
业务Mapper是使用“tk.mybatis.spring.mapper.MapperScannerConfigurer”来自动配置,
from mybatis-spring-boot.
你用 mybatis-starter 了吗?也有可能是自动配置扫描到了接口。
from mybatis-spring-boot.
这个有。代码写的比较乱,把能用或不能用的dependencies都放到Pom文件中了。
但是在代码中显式声明了tk.mybatis.spring.mapper.MapperScannerConfigurer,按照starter这种自动配置的逻辑,如果有MapperScannerConfigurer的实例了,就不会再重复初始化实例了
这样看的话,应该也没有什么影响吧
from mybatis-spring-boot.
这里有一个问题,如果自定义的Mapper接口在AMapper所在包的下面或者子包下面也会报这样的错误。
@abel533
from mybatis-spring-boot.
Related Issues (20)
- 将 mybatis-spring-boot-starter:1.3.2升级2.0.0 程序报错 HOT 1
- 请问此项目不支持yml配置吗?一定要使用properties? HOT 1
- 分页
- 在springboot中如何配置自定义的mybatis拦截器和分页拦截器的执行书顺序 HOT 3
- 升级版2.0.0及以上报异常Caused by: java.lang.NoSuchMethodException: tk.mybatis.mapper.provider.base.BaseInsertProvider.<init>()。并且@tk.mybatis.spring.annotation.MapperScan("com.sinosoft.**.domain") HOT 2
- BaseResultMap怎么生成了两份 HOT 1
- [BUG] SpringBoot 2.1.7 异常信息如下 HOT 1
- 自定义interceptor和pageInterceptor执行顺序是如何 的,有没有办法指定执行顺序 HOT 1
- 当使用Example查询实体中包含名为rank的字段,在mysql8中会语法异常 HOT 1
- 当第一页就查出全部行数时不排序
- 建议添加支持JPA功能
- 请问在Spring boot 下单元测试使用@MybatisTest注解时,如何才能加载自动生成的类?
- 5.1.4的pagehelper的com.github.pagehelper.dialect.helper.OracleDialect类下的public String getPageSql(String sql, Page page, CacheKey pageKey)方法是不是有BUG?
- 数据库字段有默认值,但是使用自动生成的dao代码, insert语句不会插入默认值 HOT 1
- tk.mybatis.spring.mapper.ClassPathMapperScanner
- 分页 HOT 1
- Date类型转换成了Timestamp
- 能用在elasticsearch搜索分页码?
- pagehelper 页数传递超过总页数为啥不会返回空 HOT 1
- AggregationMapper使用报错
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mybatis-spring-boot.