报错截图:

解决方法:

  只能扫描到自定义的mapper,不能扫描到其他文件。

  @MapperScan("com.streamax.s17.tms.dao.pper.repository")

1. 继承通用Mapper

  此接口不能同其他Mapper一起,该类不能被当做普通Mapper一样被扫描,否则会出错。

package com.streamax.s17.tms.dao.mapper.core;

import tk.mybatis.mapper.common.BaseMapper;
import tk.mybatis.mapper.common.MySqlMapper; /**
* @author cf
* @date 2018/11/21
*/
public interface CoreMapper<T> extends BaseMapper<T>, MySqlMapper<T> {
}

2. 自定义Mapper继承CoreMapper

  自定义的 Mapper 通过对应有xml的映射文件

  自定义Mapper.java要特别注意,不能同上面的Mapper定义在同一个包下

package com.streamax.s17.tms.dao.mapper.repository;

import com.streamax.s17.tms.dao.entity.TokenEntity;
import com.streamax.s17.tms.dao.mapper.core.CoreMapper; /**
* @author cf
* @date 2018/11/21
*/
public interface TokenMapper extends CoreMapper<TokenEntity> { /**
* 根据 entityId 查询token
*
* @param entityId
*/
TokenEntity selectByEntityId(String entityId); }

3. MapperScan

package com.streamax.s17.tms;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication
// 只扫描自定义mapper所在包,不能扫描到继承通用mapper所在包
@MapperScan("com.streamax.s17.tms.dao.mapper.repository")
public class TmsApplication {
public static void main(String[] args) {
SpringApplication.run(TmsApplication.class, args);
}
}

 

 

Spring boot mybatis : Error creating bean with name 'com.github.pagehelper.autoconfigure.MapperAutoConfiguration': Invocation of init method failed;的更多相关文章

  1. MyBatis笔记----报错:Error creating bean with name 'sqlSessionFactory' defined in class path resource [com/ij34/mybatis/applicationContext.xml]: Invocation of init method failed; nested exception is org.sp

    四月 05, 2017 4:51:02 下午 org.springframework.context.support.ClassPathXmlApplicationContext prepareRef ...

  2. Error creating bean with name 'sqlSessionFactory' defined in class path resource [config/spring/applicationContext.xml]: Invocation of init method failed;

    我报的错: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSes ...

  3. org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [bean.xml]: Invocation of init method failed; nested exception is

    在复制xml文件进行修改的时候,我经常将不小心对原文件进行修改,而导致创建bean出错.报错如下所示: Exception sending context initialized event to l ...

  4. Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Unable t

    spring与hibernate整合然后出现如下错误: org.springframework.beans.factory.BeanCreationException: Error creating ...

  5. Error creating bean with name 'userRepository': Invocation of init method failed;

    2019-11-25 19:43:49.482 INFO 6528 --- [ main] c.g.c.y.core.impl.AbstractController : Controller has ...

  6. Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; neste

    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFacto ...

  7. MyBatis与Spring MVC结合时,使用DAO注入出现:Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Property 'sqlSessionFactory' or 'sqlSessionTemplate' are required

    错误源自使用了这个例子:http://www.yihaomen.com/article/java/336.htm,如果运行时会出现如下错误: Invocation of init method fai ...

  8. 整合mybatis和spring时 Error creating bean with name 'sqlSessionFactory' defined in class path resource

    今天在整合mybatis和spring的时候出的错 报错如下 Exception in thread "main" org.springframework.beans.factor ...

  9. Spring Cloud报错Error creating bean with name 'requestMappingHandlerMapping'

    如果我们使用Spring Cloud的Feign实现熔断,首先需要自定义一个熔断类,实现你的feign接口,然后实现方法,这些方法就是熔断方法,最后需要在你的feign接口中指定fallback为自定 ...

随机推荐

  1. 牛客训练三:处女座和小姐姐(三)(数位dp)

    题目链接:传送门 思路:数位dp的记忆化搜索模板 从高位向低位枚举,逐位确定每一位的6的个数,dp[i][s]表示处理到第i条边,状态为s时的数字的个数. 注意,要使用long long类型. #in ...

  2. Oracle中根据当前时间和活动类型去数据库查询活动id

    活动类型默认是1,代表邀请好友 select * from t_invite_activityinfo twhere sysdate >= t.begintime and sysdate< ...

  3. BZOJ 1059 [ZJOI2007]矩阵游戏 (二分图最大匹配)

    1059: [ZJOI2007]矩阵游戏 Time Limit: 10 Sec  Memory Limit: 162 MBSubmit: 5281  Solved: 2530[Submit][Stat ...

  4. 乌龙之MySQL slave IO status:connecting

    搭建了一个主从,状态一直如下: 检查错误日志报错如下: review搭建过程,语法并没有问题. 检查用户及网络,也没有问题: so?what is the cause ? 等等....貌似上面搭建用的 ...

  5. CSS定位之position详解

    position属性 在前端中,position是很常见的属性.通过这个属性可以调整dom元素在浏览器中显示的位置. 它有几个常用的属性: static 默认值.通常是在覆盖absolute或者rel ...

  6. DC画线

    CClientDC hdc(this);//获取DC CPen pen(PS_SOLID,4,RGB(255,0,0));//创建一支红笔 CPen * pOldPen=hdc.SelectObjec ...

  7. 最完美的Linux桌面软件

    下面是关于Linux桌面环境下,目前为止最完美的部分.之所以说他们完美,是因为他们不但很养眼,而且也使用最好的多媒体技术,有最好的可用性.在某些方面,他们甚至超过了Windows和Mac-OS. 基础 ...

  8. What's New In Python 3.X

    As Python updating to python 3.6, its performance is better than Python 2.x, which is good news to e ...

  9. 各版本.NET委托的写法回顾(转)

    转自:http://www.csharpwin.com/csharpspace/7548r2766.shtml 在<关于最近面试的一点感想>一文中,Michael同学谈到他在面试时询问对方 ...

  10. spring整合quartz时间任务调度框架

    spring整合quartz框架 1.创建maven工程 2.导入jar包(pom.xml) <dependencies> <dependency> <groupId&g ...