今天构建一个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. Project Euler 11 Largest product in a grid

    题意:在这个20×20方阵中,四个在同一方向(从下至上.从上至下.从右至左.从左至右或者对角线)上相邻的数的乘积最大是多少? 思路:暴力去枚举以 ( x , y ) 为中心拓展的四个方向 /***** ...

  2. POJ 1061 青蛙的约会( 拓欧经典题 )

    链接:传送门 思路:简单拓展欧几里德,分析后可以得到方程 x + m * t = y + n * t + L * s( s控制圈数,t代表跳t次会碰面 ),经过化简可以得到 ( n - m ) * t ...

  3. POJ 2376 Cleaning Shifts (线段树优化DP)

    题目大意:给你很多条线段,开头结尾是$[l,r]$,让你覆盖整个区间$[1,T]$,求最少的线段数 题目传送门 线段树优化$DP$裸题.. 先去掉所有能被其他线段包含的线段,这种线段一定不在最优解里 ...

  4. [SCOI2010] 股票交易 (单调队列优化dp)

    题目描述 最近lxhgww又迷上了投资股票,通过一段时间的观察和学习,他总结出了股票行情的一些规律. 通过一段时间的观察,lxhgww预测到了未来T天内某只股票的走势,第i天的股票买入价为每股APi, ...

  5. svn查看工程版本库的url地址

    打开cmd,cd到工程目录,使用svn的命令:svn info 完.

  6. [Beginning SharePoint Designer 2010]Chapter4 发布页面

    本章概要: 1.SharePoint中的Web内容管理 2.SharePoint发布系统的特性 3.SharePoint发布页面的组成 4.母板页 5.如何构建页面布局和他们潜在的内容类型

  7. Python标准库:内置函数callable(object)

    假设对象object參数是能够调用的对象,就返回True.否则返回False.只是要注意的是,当一个对象是能够调用的.并不表示调用该对象时运行一定成功,但不可调用的对象去调用时一定不会成功.假设类对象 ...

  8. SVN打tag

          SVN打tag是一个非经常常使用的功能,要谈打tag,还得从SVN官方推荐的文件夹结构说起.SVN官方推荐在一个版本号库的根文件夹下先建立trunk.branches.tags这三个文件夹 ...

  9. MMORPG大型游戏设计与开发(server 游戏场景 事件)

    游戏截图 场景事件 一个完整的对象一般都拥有事件,至于什么是事件在这里就不多解释了. 在场景中的事件在天龙/武侠世界中的事件包含场景初始化.场景定时器.场景退出.玩家进入场景.角色升级.角色死亡.角色 ...

  10. 深入浅出VGA和DVI接口

    由CrazyBingo修改…… 前言:目前显示器的主流接口是VGA.DVI以及HDMI,再加上一个比较少有的Displayport接口,一共可归为四类.相信不少消费者对这些接口认识并不多,特别是普通用 ...