Spring boot mybatis : Error creating bean with name 'com.github.pagehelper.autoconfigure.MapperAutoConfiguration': Invocation of init method failed;
报错截图:

解决方法:
只能扫描到自定义的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;的更多相关文章
- 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 ...
- 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 ...
- 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 ...
- 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 ...
- 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 ...
- 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 ...
- 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 ...
- 整合mybatis和spring时 Error creating bean with name 'sqlSessionFactory' defined in class path resource
今天在整合mybatis和spring的时候出的错 报错如下 Exception in thread "main" org.springframework.beans.factor ...
- Spring Cloud报错Error creating bean with name 'requestMappingHandlerMapping'
如果我们使用Spring Cloud的Feign实现熔断,首先需要自定义一个熔断类,实现你的feign接口,然后实现方法,这些方法就是熔断方法,最后需要在你的feign接口中指定fallback为自定 ...
随机推荐
- Django+Uwsgi+Nginx项目部署文档
一.基本环境搭建 1)查看服务器 [root@Myjumpserver ~]# cat /etc/sysconfig/selinux SELINUX=disabled SELINUXTYPE=targ ...
- ubunut下安装ibus_pinyin中文输入法
ubuntu安装中文输入法,,此处一ibus-pinyin为例为其安装中文输入法,,, 1. 设置(setting)---语言支持(language support)---汉语(chinese),,, ...
- Python10/17-re模块/hashlib模块/logging模块
import logging # 1.日志的级别# logging.debug("这是一个调试信息") # 10# logging.info("常规信息") # ...
- C++中1/0和1/0.0的区别
参考:https://zhidao.baidu.com/question/1494117716904764979.html 问题说明:在Dev中1/0会报错“除数不得为0”,但是1/0.0不报错,并且 ...
- CHAPITRE III
Il me fallut longtemps pour comprendre d'où il venait. Le petit prince, qui me posait beaucoup de qu ...
- php,判断ajax,get,post
PHP自定义函数判断是否为Get.Post及Ajax提交的方法 /** * 是否是AJAx提交的 * @return bool */ function isAjax(){ if(isset($_SER ...
- 学以致用一 安装centos7.2虚拟机
5说来惭愧,也是很久没来博客园了.距离上次写的已经快一年,只能说时间过的真的很快. 而如果这一年一直在坚持认真学习的话,收获肯定很多.然而我确又浪费了很多光阴,不得不恨这人生苦短. 在这一年里,小孩还 ...
- Ng第十九课:总结(Conclusion)
19.1 总结和致谢 欢迎来到<机器学习>课的最后一段视频.我们已经一起学习很长一段时间了.在最后视频中,我想快速地回顾一下这门课的主要内容,然后简单说几句想说的话. 作为这门课的结束时 ...
- Maven之java application _HelloWord
maven 是一个项目构建的一个工具; 一.环境的配置; 1.下载maven 解压放在一个路径下为了好找我们就将该文件放在 D:\javaNew\apache-maven-3.3.9 2.配置本地仓 ...
- day28(ajax之js原生代码实现)
ajax ajax:异步页面无刷新技术 AJAX:异步的 JavaScript And XML. * 使用的是老的技术,用的是新的思想. AJAX的功能:完成页面的局部刷新,不中断用户的体验. XML ...