zoukankan      html  css  js  c++  java
  • 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

    翻译:xxxService 这个bean已经被注入到xxxServiceA、xxxServiceB这两个bean中了,他们之间存在循环引用(依赖),也就是说:xxxServiceA中注入了xxxService,而xxxService中也要注入xxxServiceA,所以就会出现这种情况

    第一次遇见,记录下

    当我在启动我的springBoot项目时出现以下错误

    Caused by: org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'cmsSiteService': Bean with name 'cmsSiteService' has been injected into other beans [cmsFormService] in its raw version as part of a circular reference, but has eventually been wrapped. This means that said other beans do not use the final version of the bean. This is often the result of over-eager type matching - consider using 'getBeanNamesOfType' with the 'allowEagerInit' flag turned off, for example.
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:622)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515)
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
        at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:277)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1251)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1171)
        at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:593)
        ... 19 common frames omitted

    第一次见,不用说百度

    最后发现是两个类相互依赖注入的问题。

  • 相关阅读:
    Tree Constructe(icpc济南)(二分图+构造)
    Cleaning(CF1474D)
    Matrix Equation (2020icpc济南)
    关于位运算
    poj2540半平面交+判范围
    做题记录0(并查集|树状数组)
    ac自动机
    二次剩余
    BSGS算法
    无向图的桥
  • 原文地址:https://www.cnblogs.com/bigbigxiao/p/13141818.html
Copyright © 2011-2022 走看看