springboot 异常: Requested bean is currently in creation: Is there an unresolvable circular reference?

Posted 在路上

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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:antdWorkspacepayadminv5	argetclassescompaycloudxdaoAdminUserDao.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:antdWorkspacepayadminv5	argetclassescompaycloudxdaoAdminUserDao.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?的主要内容,如果未能解决你的问题,请参考以下文章

异常解决——Tomcat启动异常:Cannot assign requested address

HTTP Status 404(The requested resource is not available)异常解决

Xamarin.Android 使用 SQLite 出现 Index -1 requested, with a size of 10 异常

springboot:创建工程,SunCertPathBuilderException: unable to find valid certification path to requested ta

springboot出现Requested bean is currently in creation: Is there an unresolvable circular reference?(代码

oracle异常:ORA-01422: exact fetch returns more than requested