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 encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'adminController': Unsatisfied dependency expressed through field 'adminUserService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'adminUserService': Unsatisfied dependency expressed through field 'baseMapper'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'adminUserDao' defined in file [E:\antdWorkspace\payadminv5\target\classes\com\paycloudx\dao\AdminUserDao.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [com/baomidou/mybatisplus/spring/boot/starter/MybatisPlusAutoConfiguration.class]: Unsatisfied dependency expressed through method 'sqlSessionFactory' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dataSource' defined in class path resource [com/paycloudx/datasources/DynamicDataSourceConfig.class]: Unsatisfied dependency expressed through method 'dataSource' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'firstDataSource' defined in class path resource [com/paycloudx/datasources/DynamicDataSourceConfig.class]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.autoconfigure.jdbc.DataSourceInitializerInvoker': Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'dataSource': Requested bean is currently in creation: Is there an unresolvable circular reference?
2018-07-31 11:56:18.825 INFO 10316 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2018-07-31 11:56:18.834 WARN 10316 --- [ost-startStop-1] o.a.c.loader.WebappClassLoaderBase : The web application [ROOT] appears to have started a thread named [Abandoned connection cleanup thread] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
java.lang.Object.wait(Native Method)
java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:143)
com.mysql.cj.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.java:43)
2018-07-31 11:56:18.845 INFO 10316 --- [ main] ConditionEvaluationReportLoggingListener : Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2018-07-31 11:56:18.847 ERROR 10316 --- [ 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: adminController (field private com.paycloudx.service.AdminUserService com.paycloudx.controller.AdminController.adminUserService)
↓
adminUserService (field protected com.baomidou.mybatisplus.mapper.BaseMapper com.baomidou.mybatisplus.service.impl.ServiceImpl.baseMapper)
↓
adminUserDao defined in file [E:\antdWorkspace\payadminv5\target\classes\com\paycloudx\dao\AdminUserDao.class]
↓
sqlSessionFactory defined in class path resource [com/baomidou/mybatisplus/spring/boot/starter/MybatisPlusAutoConfiguration.class]
┌─────┐
| dataSource defined in class path resource [com/paycloudx/datasources/DynamicDataSourceConfig.class]
↑ ↓
| firstDataSource defined in class path resource [com/paycloudx/datasources/DynamicDataSourceConfig.class]
↑ ↓
| org.springframework.boot.autoconfigure.jdbc.DataSourceInitializerInvoker
└─────┘ Process finished with exit code 1
异常信息
项目框架:
springboot + Mybatis + Mybatis Plus
配置了druid多数据源,刚搭建的时候启动正常,写好Controller,Service,Dao等代码后,启动报错。
百度不到对应的错了,问了公司大神,一下子就解决了,唉。
解决方案:
启动类注解:
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
springboot 异常: Requested bean is currently in creation: Is there an unresolvable circular reference?的更多相关文章
- SpringBoot项目意外出现 循环依赖和注入的对象意外是Null的问题 Requested bean is currently in creation: Is there an unresolvable circular reference? 或 nested exception is java.lang.NullPointerException
1.Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ...
- Spirng 循环依赖报错:Requested bean is currently in creation: Is there an unresolvable circular reference?
1:前言 最近在项目中遇到了一次循环依赖报错的问题,虽然解决的很快,但是有些不明白的地方,特此记录. 在此我把 bean 的结构和 注入方式单独拎出来进行演示 1.1:报错提示 1.2:错误日志 Ex ...
- Requested bean is currently in creation: Is there an unresolvable circular reference?
spring容器初始化报错:循环依赖,错误信息如下: Requested bean is currently in creation: Is there an unresolvable circula ...
- Springboot@Configuration和@Bean详解
Springboot@Configuration和@Bean详解 一.@Configuration @Target({ElementType.TYPE}) @Retention(RetentionPo ...
- 在SpringMVC中,当Json序列化,反序列化失败的时候,会抛出HttpMessageNotReadableException异常, 当Bean validation失败的时候,会抛出MethodArgumentNotValidException异常,因此,只需要在ExceptionHandler类中添加处理对应异常的方法即可。
在SpringMVC中,当Json序列化,反序列化失败的时候,会抛出HttpMessageNotReadableException异常, 当Bean validation失败的时候,会抛出Method ...
- springBoot异常统一处理
springBoot异常统一处理 采用@ControllerAdvice注解和@ExceptionHandler注解,可以对异常进行统一处理. 1.结构图: 2.pom.xml文件: <?xml ...
- 品Spring:SpringBoot轻松取胜bean定义注册的“第一阶段”
上一篇文章强调了bean定义注册占Spring应用的半壁江山.而且详细介绍了两个重量级的注册bean定义的类. 今天就以SpringBoot为例,来看看整个SpringBoot应用的bean定义是如何 ...
- springBoot 动态注入bean(bean的注入时机)
springBoot 动态注入bean(bean的注入时机) 参考博客:https://blog.csdn.net/xcy1193068639/article/details/81517456
- Bean with name 'xxxService' has been injected into other beans [xxxServiceA,xxxServiceB] in its raw version as part of a circular reference, but has eventually been wrapped
启动项目,通过@Autowired注入对象,出现循环依赖,导致项目启动失败,具体报错信息如下: Exception encountered during context initialization ...
随机推荐
- Android Thermal-engine
Thermal Engine Thermal 相关的东西主要在Vendor/qcom/proprietary/thermal-engine 目录下: thermal-engine.conf 文件可以用 ...
- C# 执行sql语句批量更新
int x = db.Database.ExecuteSqlCommand(string.Format("update T_Pension SET UnitType = '{0}' WHER ...
- Redis 之order set有序集合结构及命令详解
1.zadd key score1 value1 score2 value2 添加元素 2.zrem key value1 value2 .. 删除集合中的元素 3.zremrangebyscor ...
- .net 程序集加载,版本不匹配的解决方法
经常有些时候,A.dll引用的是Microsoft.EntityFrameworkCore.dll version=1.0.0.0 publicKeyToken="adb9793829dda ...
- CAD取Excel表格(com接口)
1 2 3 4 5 6 7 8 9 10 11 12 MxDrawResbuf ret = (MxDrawResbuf)axMxDrawX1.Call("ExApp_GetExcel&quo ...
- java图形验证码实现
前言 本文首发于公众号[我的小碗汤]本公众号免费提供csdn下载服务,海量IT学习资源,如果你准备入IT坑,励志成为优秀的程序猿,那么这些资源很适合你,包括但不限于java.go.python.spr ...
- python之BeautifulSoup库
1. BeautifulSoup库简介 和 lxml 一样,Beautiful Soup 也是一个HTML/XML的解析器,主要的功能也是如何解析和提取 HTML/XML 数据.lxml 只会局部遍历 ...
- php第十六节课
分页 <?php /** file: page.class.php 完美分页类 Page */ class Page { private $total; //数据表中总记录数 private $ ...
- MarkDown 语法及使用
MarkDown #什么是Markdown - 定义 - markdown 是一款轻量级标记语言,功能没有HTML标记语言那么强大 ,Markdown专注书写! #试用人群: 程序员/等计算机爱好者 ...
- Linux:用户和组总结
从创建文件说起:useradd xiaomi 这里是创建了xiaomi用户 默认系统还会创建:/home/xiaomi /var/mail/xiaomi 即家目录和 ...