报错截图:

解决方法:

  只能扫描到自定义的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. 2018.10.27 bzoj3209: 花神的数论题(数位dp)

    传送门 数位dpdpdp经典题. 题面已经暗示了我们按照二进制位来数位dpdpdp. 直接dpdpdp多少个数有111个111,222个111,333个111-, 然后快速幂算就行了. 于是我们枚举前 ...

  2. 2.7 Sobel导数

    OpenCV函数 Sobel(src_gray,grad_x/grad_y,ddepth,x_order,y_order,scale,delta,BORDER_DEFAULT ) Scharr( ) ...

  3. springboot实现xml传参和返回值

    1.新建maven工程xml-bean-convert pom.xml如下 <?xml version="1.0" encoding="UTF-8"?&g ...

  4. 以太网MAC地址规范

    原文地址:http://blog.csdn.net/skyflying2012/article/details/40322563 之前一段时间在做网卡驱动的工作,现在产品量产,利用ifconfig e ...

  5. if结构和逻辑运算符

    一 :if选择结构 语法结构: 01.单个if if(表达式){ 如果满足表达式 则执行的代码 } 02.if(表达式) else if(表达式){ 如果满足表达式 则执行的代码 }else{ 不满足 ...

  6. PHP上传文件参考配置大文件上传

    PHP用超级全局变量数组$_FILES来记录文件上传相关信息的. 1.file_uploads=on/off 是否允许通过http方式上传文件 2.max_execution_time=30 允许脚本 ...

  7. TreeSet集合为什么要实现Comparable?

    首先,让我们来看看JDK中TreeSet类的add方法 /** * Adds the specified element to this set if it is not already presen ...

  8. mybatis-generator扩展教程系列 -- 自定义generatorConfig.xml参数

    http://blog.csdn.net/shadowsick/article/details/53413235

  9. (转)Eclipse开发Web项目

    1. 建立最简单的JSP和servlet http://wenku.baidu.com/link?url=bcf8iwB3E5_gjl46WfZAekQUWsps0-G3MAbbKz5totQcvmS ...

  10. android-基础编程-Dialog

    Dialog是一种常见的控件. 设置对话框一般步骤如下: 1.实例化dialog 由于AlertDialog的构造函数的关系,不能直接实例化,需要利用Builder来实例化,如 AlertDialog ...