其他分享
首页 > 其他分享> > springboot项目引入通用mapper(tk.mybatis.mapper)的时候一些可能会踩的坑

springboot项目引入通用mapper(tk.mybatis.mapper)的时候一些可能会踩的坑

作者:互联网

主要解决springboot项目引入通用mapper(tk.mybatis.mapper)的时候一些可能会踩的坑:诸如tk.mybatis.mapper.provider.base.BaseSelectProvider.()

java.lang.ClassCastException: sun.reflect.generics.reflectiveObjects.TypeVariableImpl cannot be cast to java.lang.Class

 


     tk.mybatis
     mapper-spring-boot-starter
     2.0.0
mapper:
    mappers: cn.hy.hyerp.erp.common.dal.BaseDao
    not-empty: false
    identity: mysql

启动而不是import org.mybatis.spring.annotation.MapperScan;​​​​​​不然会报错:

Cause: java.lang.InstantiationException: tk.mybatis.mapper.provider.base.BaseSelectProvider] with root cause
java.lang.NoSuchMethodException: tk.mybatis.mapper.provider.base.BaseSelectProvider.()

 

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'baseDao' defined in file [BaseDao.class]: Invocation of init method failed;

nested exception is tk.mybatis.mapper.MapperException: tk.mybatis.mapper.MapperException: java.lang.ClassCastException: sun.reflect.generics.reflectiveObjects.TypeVariableImpl cannot be cast to java.lang.Class

 

标签:lang,mapper,java,springboot,BaseDao,tk,mybatis
来源: https://www.cnblogs.com/youqc/p/14472416.html