【异常】The dependencies of some of the beans in the application context form a cycle
一、异常出现场景以及异常信息
场景:SpringBoot中自定义DataSource数据源
异常信息:
-- ::30.807 ERROR --- [ main] o.s.b.d.LoggingFailureAnalysisReporter : ***************************
APPLICATION FAILED TO START
*************************** Description: The dependencies of some of the beans in the application context form a cycle: userServiceImpl (field com.zbq.springbootdemo.dao.UserDao com.zbq.springbootdemo.service.UserServiceImpl.userDao)
↓
userDao defined in file [/Users/zhangboqing/Software/MyGithub/spring-boot-demo/target/classes/com/zbq/springbootdemo/dao/UserDao.class]
↓
sqlSessionFactory defined in class path resource [org/mybatis/spring/boot/autoconfigure/MybatisAutoConfiguration.class]
┌─────┐
| dynamicDataSource defined in class path resource [com/zbq/springbootdemo/config/multidatasource/DataSourceConfig.class]
↑ ↓
| primary defined in class path resource [com/zbq/springbootdemo/config/multidatasource/DataSourceConfig.class]
↑ ↓
| org.springframework.boot.autoconfigure.jdbc.DataSourceInitializerInvoker
二、解决方案
排除Spring Boot数据源自动配置类
// 自定义数据源一定要排除SpringBoot自动配置数据源,不然会出现循环引用的问题,The dependencies of some of the beans in the application context form a cycle
@EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class})
【异常】The dependencies of some of the beans in the application context form a cycle的更多相关文章
- [Android Studio] 取消引用库打包出现异常-- provided dependencies can only be jars
Warning: Project App: provided dependencies can only be jars. com.android.support:appcompat-v7:22.2. ...
- springboot启动报异常,Failed to load property source from location 'classpath:/application.yml'
学习springboot,在启动时抛出下图异常 往下看异常信息,找到异常的具体位置 找到application.yml文件的对应位置,发现params配置前面多了空格 去掉空格重新启动,可以了 写代码 ...
- 【异常】Application failed to start due to an exception org.springframework.beans.factory.BeanCurrentlyInCreationException
一. 异常信息: 2018-05-17 18:03:22.224 -DEBUG [ restartedMain] o.s.b.d.LoggingFailureAnalysisReporter ...
- springboot 异常: Requested bean is currently in creation: Is there an unresolvable circular reference?
2018-07-31 11:56:18.812 WARN 10316 --- [ main] ConfigServletWebServerApplicationContext : Exception ...
- 在使用 Spring Boot 和 MyBatis 动态切换数据源时遇到的问题以及解决方法
相关项目地址:https://github.com/helloworlde/SpringBoot-DynamicDataSource 1. org.apache.ibatis.binding.Bind ...
- SpringBoot项目中遇到的BUG
1.启动项目的时候报错 1.Error starting ApplicationContext. To display the auto-configuration report re-run you ...
- 全网最新的nacos 2.1.0集群多节点部署教程
原文链接:全网最新的nacos 2.1.0集群多节点部署教程-语雀 基本信息 进度整理中 版本 2.1.0 版本发布日期 2022-04-29 git revision number b5845313 ...
- 折腾了我两天的springboot数据源datasource循环依赖问题,都被搞疯掉了
在做项目重构的时候增加了两个功能 1.多数据源. 2.token的验证从以前的数据库验证,移到了redis端. 1.多数据源使用 druid-spring-boot-starter 套件 其核心代码如 ...
- 【Spring Boot】Spring Boot之使用AOP实现数据库多数据源自动切换
一.添加maven坐标 <!-- aop --> <dependency> <groupId>org.springframework.boot</groupI ...
随机推荐
- source ~/.bashrc
编辑命令: gedit ~/.bashrc source ~/.bashrc 每次修改.bashrc后,使用source ~/.bashrc(或者 . ~/.bashrc)就可以立刻加载修改后的设置, ...
- LG4035/BZOJ1013 「JSOI2008」球形空间产生器 高斯消元
问题描述 LG4035 BZOJ1013 题解 设答案为\((p_1,p_2,p_3,...,p_n)\) 因为是一个球体,令其半径为\(r\),则有 \[\sum_{i=1}^{n}{(a_i-p_ ...
- xBIM之二:构建墙和门窗
研究了两天,终于实现了利用xBIM自动输出墙和门窗 比较粗糙的源码如下: private void Form1_Load(object sender, EventArgs e) { //first c ...
- Zabbix设置邮件报警
邮件报警 概述当监控项收集了数据后,触发器会根据异常状态触发报警.根据一些报警机制,它也会通知我们一些重要的事件,而不需要我们直接在Zabbix前端进行查看.这就是通知(Notifications)的 ...
- [学习笔记] 网络最大流的HLPP算法
#define \(u\)的伴点集合 与\(u\)相隔一条边的且\(u\)能达到的点的集合 \(0x00~ {}~Preface\) \(HLPP(Highest~Label~Preflow~Push ...
- [LeetCode] 617. Merge Two Binary Trees 合并二叉树
Given two binary trees and imagine that when you put one of them to cover the other, some nodes of t ...
- 第04组 Alpha冲刺(3/6)
队名:new game 组长博客:戳 作业博客:戳 组员情况 鲍子涵(队长) 燃尽图 过去两天完成了哪些任务 才两天,也就是实现一些功能而已 复习 接下来的计划 实现更多的功能 为下周的比赛准备 还剩 ...
- k8s之系统组件架构-02
k8s系统架构图 网络组件:calico+kube-proxy(IPVS) 网络暴露:traefik+ingress,分别对HTTP与TCP的服务暴露 存储:glusterfs(heketi管理) 日 ...
- json data转匿名对象C#
using Newtonsoft.Json.Linq; 代码如下: static void Main(string[] args) { Console.WriteLine("Test 4.8 ...
- RestTemplate使用教程
原文地址:https://www.cnblogs.com/f-anything/p/10084215.html 一.概述 spring框架提供的RestTemplate类可用于在应用中调用rest服务 ...