今天构建一个springboot 项目,采用mybatis+mysql 然后就出现了这种错误....浪费我半天时间

 Description:

 Field loginLogMapper in com.guoll.modules.sysmanage.service.PassagewayService required a bean of type 'com.guoll.modules.sysmanage.mapper.LoginLogMapper' that could not be found.

 The injection point has the following annotations:
- @org.springframework.beans.factory.annotation.Autowired(required=true) Action: Consider defining a bean of type 'com.guoll.modules.sysmanage.mapper.LoginLogMapper' in your configuration. Process finished with exit code 0

错误原因:是由于springboot 扫描不到 mapper

解决方案:

第一种:在mapper包下类配置@Mapper 注解

第二种:在springboot 启动类上配置包扫描@ComponentScan()

第三种:在springboot 启动类上配置Mapper扫描@MapperScan(注意:必须将路径指定到 xxx.xxx.xxx.mapper 包为止,否则依旧扫描不到) 多个mapper路径 可以以 @MapperScan({mapper1路径,mapper2路径})

这种本人亲测


第四种解决方法,就是将 spring boot启动类方法mapper上级,这样也可以扫描到

工作中出了问题,解决时间太久,记录一下

Consider defining a bean of type 'XX.XX.XX.XX.mapper.XXMapper' in your configuration.的更多相关文章

  1. Consider defining a bean of type 'org.springframework.data.redis.connection.RedisConnectionFactory' in your configuration

    Description: Parameter 0 of method redisTemplate in com.liaojie.cloud.auth.server.config.redis.Redis ...

  2. 【spring boot】mybatis启动报错:Consider defining a bean of type 'com.newhope.interview.dao.UserMapper' in your configuration. 【Mapper类不能被找到】@Mapper 和@MapperScan注解的区别

    启动报错: 2018-05-16 17:22:58.161 ERROR 4080 --- Disconnected from the target VM, address: '127.0.0.1:50 ...

  3. Spring Boot:Consider defining a bean of type '*.*.*' in your configuration解决方案

    果然不看教程直接使用在遇到问题会懵逼,连解决问题都得搜半天还不一定能帮你解决了... ***************************APPLICATION FAILED TO START*** ...

  4. Consider defining a bean of type 'com.lvjing.dao.DeviceStatusMapper' in your configuration.

    "C:\Program Files\Java\jdk1.8.0_181\bin\java.exe" "-javaagent:C:\Program Files\JetBra ...

  5. springboot 工程启动报错之Consider defining a bean of type ‘XXX’ in your configuration.

    一.前言: 使用springboot自动注入的方式搭建好了工程,结果启动的时候报错了!!!,错误如下图: Description: Field userEntityMapper in com.xxx. ...

  6. 关于spring boot自动注入出现Consider defining a bean of type 'xxx' in your configuration问题解决方案

    搭建完spring boot的demo后自然要实现自动注入来体现spring ioc的便利了,但是我在实施过程中出现了这么一个问题,见下面,这里找到解决办法记录下来,供遇到同样的问题的同僚参考 Des ...

  7. 记一个SpringBoot中属性注入失败的问题Consider defining a bean of type ''' in your configuration

    今天遇到的一个问题: 代码检查了好几次,都没有错误,但是启动时就会报错Consider defining a bean of type ''' in your configuration. 启动类在c ...

  8. Consider defining a bean of type 'package' in your configuration [Spring-Boot]

    https://stackoverflow.com/questions/40384056/consider-defining-a-bean-of-type-package-in-your-config ...

  9. Spring Cloud ZooKeeper集成Feign的坑1,错误:Consider defining a bean of type 'org.springframework.web.client.RestTemplate' in your configuration.

    错误如下: ERROR 31473 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter : *************************** A ...

随机推荐

  1. 简述JVM、JRE、JDK的关系及作用

    1.JVM:java虚拟机 . 作用:保证java语言跨平台. 2.JRE:java运行环境 jre=java虚拟机+核心类库. 作用:java程序的运行环境. 3.JDK :java开发工具集.JD ...

  2. PHP算法之判断是否是质数

    质数的定义 质数又称素数.一个大于1的自然数,除了1和它自身外,不能整除其他自然数的数叫做质数:否则称为合数. 实现思路 循环所有可能的备选数字,然后和中间数以下且大于等于2的整数进行整除比较,如果能 ...

  3. Python之Mail编程

    # Mail编程- 管理程序 - Euroda使邮件普及 - Netscape,outlook,forxmail后来居上 - Hotmail使用浏览器发送邮件 ## 邮件工作流程- MUA邮件用户代理 ...

  4. iOS相册实现与AssetsLibrary框架使用

    概述 在iOS中如果想要获取手机相册里面的图片或者视频的话就要用到系统自带的AssetsLibrary框架,AssetsLibrary.framework中包含以下文件 #import <Ass ...

  5. 【基础训练】HDOJ2032杨辉三角

    watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvWEdzaWxlbmNl/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA ...

  6. 两列等高布局 padding+margin的负值 CSS布局奇淫技巧之-多列等高

    代码: 效果图: watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/ ...

  7. 图像算法研究---Adaboost算法具体解释

    本篇文章先介绍了提升放法和AdaBoost算法.已经了解的可以直接跳过.后面给出了AdaBoost算法的两个样例.附有详细计算过程. 1.提升方法(来源于统计学习方法) 提升方法是一种经常使用的统计学 ...

  8. android 九宫格(16宫格)控件

    public class NineRectView extends ViewGroup { private Context ctx; private int wSize,hSize,row,colum ...

  9. 鸟哥Linux私房菜知识点总结3到5章

    感觉自己对Linux的理解一直不够,所以近期翻看了一本<鸟哥的Linux私房菜>.这是一本基础的书,万丈高楼平地起,会的不多但能够学.这是我整理的一些知识点,尽管非常基础.希望和大家共同交 ...

  10. emacs使用本地emacs server模式打开远程文件

    使用emacs的用户都知道,一般要打开远程机器上的文件要使用TrampMode模式,调用方式例如以下: C-x C-f /remotehost:filename RET (or /method:use ...