一、异常出现场景以及异常信息

场景: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的更多相关文章

  1. [Android Studio] 取消引用库打包出现异常-- provided dependencies can only be jars

    Warning: Project App: provided dependencies can only be jars. com.android.support:appcompat-v7:22.2. ...

  2. springboot启动报异常,Failed to load property source from location 'classpath:/application.yml'

    学习springboot,在启动时抛出下图异常 往下看异常信息,找到异常的具体位置 找到application.yml文件的对应位置,发现params配置前面多了空格 去掉空格重新启动,可以了 写代码 ...

  3. 【异常】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   ...

  4. 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 ...

  5. 在使用 Spring Boot 和 MyBatis 动态切换数据源时遇到的问题以及解决方法

    相关项目地址:https://github.com/helloworlde/SpringBoot-DynamicDataSource 1. org.apache.ibatis.binding.Bind ...

  6. SpringBoot项目中遇到的BUG

    1.启动项目的时候报错 1.Error starting ApplicationContext. To display the auto-configuration report re-run you ...

  7. 全网最新的nacos 2.1.0集群多节点部署教程

    原文链接:全网最新的nacos 2.1.0集群多节点部署教程-语雀 基本信息 进度整理中 版本 2.1.0 版本发布日期 2022-04-29 git revision number b5845313 ...

  8. 折腾了我两天的springboot数据源datasource循环依赖问题,都被搞疯掉了

    在做项目重构的时候增加了两个功能 1.多数据源. 2.token的验证从以前的数据库验证,移到了redis端. 1.多数据源使用 druid-spring-boot-starter 套件 其核心代码如 ...

  9. 【Spring Boot】Spring Boot之使用AOP实现数据库多数据源自动切换

    一.添加maven坐标 <!-- aop --> <dependency> <groupId>org.springframework.boot</groupI ...

随机推荐

  1. 洛谷 P3998 [SHOI2013]发微博

    洛谷 P3998 [SHOI2013]发微博 洛谷传送门 题目描述 刚开通的 SH 微博共有n个用户(1Ln标号),在这短短一个月的时间内, 用户们活动频繁,共有m 条按时间顺序的记录: ! x 表示 ...

  2. 论文阅读笔记六十五:Enhanced Deep Residual Networks for Single Image Super-Resolution(CVPR2017)

    论文原址:https://arxiv.org/abs/1707.02921 代码: https://github.com/LimBee/NTIRE2017 摘要 以DNN进行超分辨的研究比较流行,其中 ...

  3. ESA2GJK1DH1K升级篇: 快速的移植升级程序到自己的项目(APP用户程序制作)

    前言 用户程序比较简单,但是起着至关重要的作用 用户程序是和BootLoader程序相互配合的 拷贝文件到自己的项目 APP用户程序的 stmflash.c stmflash.h 和 上一节的Boot ...

  4. 线段树模板(无lazy优化)

    区间修改与区间查询问题 模板: int ans; struct node{ int l,r,v; node(){v=;} }tree[LEN*]; int arr[LEN]; //建树 void bu ...

  5. Linux性能优化实战学习笔记:第十五讲

    一.内存映射 内存管理也是操作系统最核心的功能之一,内存主要用来存储系统和应用程序的指令.数据.缓存等 1.我们通说的内存指的是物理内存还是虚拟内存? 我们通常说的内存容量,其实这指的是物理内存,物理 ...

  6. [LeetCode] 179. Largest Number 最大组合数

    Given a list of non negative integers, arrange them such that they form the largest number. Example ...

  7. 4,VS常见问题解决(一闪而过、等问题)不断更新

    当然入门学c可以用VS,但是深入就不应该用VS(MSVC)编译器了,毕竟VS2017还没有完全支持C99(这个从VS2017没有实现变长数组可见) 但是想看c源码,还是 1. 推荐用 *nix系统 2 ...

  8. 【微信小程序】小程序中的函数节流

    大ga吼! 很久没写博客咯,今天学到了一点新知识, 记录分享一下~ 摘要: 小程序中的函数节流 场景: 从商城列表进入商品详情中时,或者生成,提交订单, 付款的时候, 若用户快速点击(一秒8键,母胎s ...

  9. (十三)golang--程序流程控制

    1.顺序控制 若没有判断,没有跳转,程序由上至下依次执行 2.分支控制 单分支if 条件表达式 { 执行代码块} 双分支if 条件表达式 { 执行代码块1} else { 执行代码块2} 多分支if ...

  10. torch_09_DCGAN_注意的细节

    DCGAN github链接:https://github.com/darr/DCGAN DCGAN:1.在一次epoch中,如果第i批的i能够整除every_print,则打印到output文件中( ...