mybatis+spring boot, mapper 提示Could not autowire. No beans of … type found
工具及背景: IntelliJ IDEA 2016.1.3 Ultimate。spring boot, maven项目,利用mybatis 注解的方式查询mysql。
业务逻辑关系:controller --> Service接口 ----> serverImpl --->Dao -->DaoImpl ---> mapper -->db
问题:mapper提示Could not autowire. No beans of … type found?如图:

其中ProductDaoMyBatisMapper是个接口,用于查询mysql,结构如下图:

解决办法:将第一张图中的ProductDaoMyBatis类序列化,即实现Serializable 接口即可,如下图:

补:pom.xml
<!--mybatis-->
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>1.1.1</version>
</dependency> 方法二: 还有一种方式,修改idea配置,将spring 的severity的值设置为"warning", 如下:

mybatis+spring boot, mapper 提示Could not autowire. No beans of … type found的更多相关文章
- mapper提示Could not autowire. No beans of … type found?
工具及背景: IntelliJ IDEA 2016.1.3 Ultimate.spring boot, maven项目,利用mybatis 注解的方式查询mysql 在自动生成工具生成代码后,serv ...
- SpringBoot注入Mapper提示Could not autowire. No beans of 'xxxMapper' type found错误
通过用Mabatis的逆向工程生成的Entity和Mapper.在Service层注入的时候一直提示Could not autowire. No beans of 'xxxMapper' type f ...
- IDEA - 错误提示 Could not autowire. No beans of '' type found
工具: IntelliJ IDEA 2019.3.4 x64 Ultimate,maven项目: 现象:如下图所示,出现Could not autowire. No beans of '' type ...
- spring boot:配置shardingsphere(sharding jdbc)使用druid数据源(druid 1.1.23 / sharding-jdbc 4.1.1 / mybatis / spring boot 2.3.3)
一,为什么要使用druid数据源? 1,druid的优点 Druid是阿里巴巴开发的号称为监控而生的数据库连接池 它的优点包括: 可以监控数据库访问性能 SQL执行日志 SQL防火墙 但spring ...
- spring boot:使用分布式事务seata(druid 1.1.23 / seata 1.3.0 / mybatis / spring boot 2.3.2)
一,什么是seata? Seata:Simpe Extensible Autonomous Transcaction Architecture, 是阿里中间件开源的分布式事务解决方案. 前身是阿里的F ...
- spring boot 运行提示:Process finished with exit code 1
spring boot 运行提示:Process finished with exit code 1 经检查发现是由于在application.properties配置文件中将某些自定义配置项移除了, ...
- spring boot mapper层传参数是用main的arg0(第一个参数),arg1(第二个参数)
spring boot mapper层传参数是用main的arg0(第一个参数),arg1(第二个参数) 大于三个参数,用map传递 public interface FrontMapper{ //= ...
- mybatis spring boot深入
[size=large]头一篇博文说了整合了spring boot和mybatis大家都可以对后台数据进行操作但是如何才能进行高效的操作数据库节省代码,下面来一起谈论哈mybatis的通用mapper ...
- Spring Boot启动提示:org.apache.catalina.LifecycleException: A child container failed during start
一.问题回顾 最近在做一个新项目,从git上下载导入idea后,启动项目,但是报了如下错误: java.util.concurrent.ExecutionException: org.apache.c ...
随机推荐
- vue-i18n国际化插件
vue-i18n国际化插件 安装,到项目目录下执行:npm install vue-i18n 配置在src\main.js里面引入vue-i18n // 语言包插件import VueI18n fro ...
- 计蒜客--移除数组中的重复元素 (set)
给定一个升序排列的数组,去掉重复的数,并输出新的数组的长度. 例如:数组 A = \{1, 1, 2\}A={1,1,2},你的程序应该输出 22 即新数组的长度,新数组为 \{1, 2\}{1,2} ...
- bzoj1625 [Usaco2007 Dec]宝石手镯
01背包 #include<algorithm> #include<iostream> #include<cstdlib> #include<cstring& ...
- 像黑客一样使用Linux命令行(转载)
阅读目录 前言 使用 tmux 复用控制台窗口 在命令行中快速移动光标 在命令行中快速删除文本 快速查看和搜索历史命令 快速引用和修饰历史命令 录制屏幕并转换为 gif 动画图片 总结 回到顶部 前言 ...
- Web开发笔记 #06# 前后端分离
前后端分离 关于“前后端分离”的深入讨论: 如何正确理解前后端分离? Web 前后端分离的意义大吗? 在上面有看到有谈“国外it公司分工”的回答,感觉挺有意思的.大概是讲国外it公司并不分前后端,只分 ...
- mysql 查询重复值
SELECT `code`,count(`code`) as count FROM `yt_coupon` GROUP BY `code` HAVING count(`code`) > ...
- JDK源码之LinkedHashSet
LinkedHashSet是HashSet和LinkList结合产生的集合,集合中的元素互不相同,且元素采用双向链表进行连接. 1.定义 LinkedHashSet继承了HashSet并且实现了Set ...
- 2016 icpc ECfinal && codeforcesgym101194
一不小心惨变旅游队,不过上海的风景不错 顺带找其他队交流一下集训经验...或许可以成为选拔和集训16级的依据 A.直接模3就可以了,2^(3*n)%7=1 C.Mr. Panda and Strips ...
- go实例—函数或方法的可变长参数
支持可变长参数列表的函数可以支持任意个传入参数,比如fmt.Println函数就是一个支持可变长参数列表的函数. 需要注意的是,可变长参数应该是函数定义的最右边的参数,即最后一个参数 package ...
- alert.log中的minact-scn: useg scan erroring out with error e:376警告
早上,开发说昨晚一台服务器的undo好像有异常,早上上去一看,库停了,正常startup之后,随手crud了一把,都正常.去看alert.log日志,发现undo某个数据块访问报I/O读错误,如下: ...