一、分析问题背景 在使用Spring框架进行开发时,开发者有时会遇到org.springframework.beans.factory.BeanCurrentlyInCreationException异常...二、可能出错的原因 导致org.springframework.beans.factory.BeanCurrentlyInCreationException报错的原因主要有以下几点: 循环依赖:Bean...通过以上步骤和注意事项,可以有效解决org.springframework.beans.factory.BeanCurrentlyInCreationException异常,确保Spring容器能够正确初始化
resolve reference to bean 'circulationa' while setting bean property 'circulationA'; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException...resolve reference to bean 'circulationa' while setting bean property 'circulationA'; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException...resolve reference to bean 'circulationa' while setting bean property 'circulationA'; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException...org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:351) ... 17 more Caused by: org.springframework.beans.factory.BeanCurrentlyInCreationException
//System.out.println(context.getBean("a", StudentA.class)); } } 执行结果报错信息为: Caused by: org.springframework.beans.factory.BeanCurrentlyInCreationException...只有请求获取的时候才会实例化对象 System.out.println(context.getBean("a", StudentA.class)); } } 打印结果: Caused by: org.springframework.beans.factory.BeanCurrentlyInCreationException
; //System.out.println(context.getBean("a", StudentA.class)); } } 执行结果报错信息为: Caused by: org.springframework.beans.factory.BeanCurrentlyInCreationException...只有请求获取的时候才会实例化对象 System.out.println(context.getBean("a", StudentA.class)); } } 打印结果: Caused by: org.springframework.beans.factory.BeanCurrentlyInCreationException
resolve reference to bean 'loginService' while setting bean property 'loginService'; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException...resolve reference to bean 'loginService' while setting bean property 'loginService'; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException...org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:351) ... 44 moreCaused by: org.springframework.beans.factory.BeanCurrentlyInCreationException...resolve reference to bean 'loginService' while setting bean property 'loginService'; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException...resolve reference to bean 'loginService' while setting bean property 'loginService'; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException
Application run failed org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating
myCardService': Unsatisfied dependency expressed through field 'workRepository'; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException...SpringApplication.java:1215) at cn.xj.CMCCApplication.main(CMCCApplication.java:31) Caused by: org.springframework.beans.factory.BeanCurrentlyInCreationException
作用域的循环依赖 否 报错信息 Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException...异常信息:bean当前创建异常org.springframework.beans.factory.BeanCurrentlyInCreationException。
: Cannot resolve reference to bean 'beanA' while setting bean property 'beanA'; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException...private com.alibaba.test.circle.Test com.alibaba.test.circle.DependentBean.test; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException
applicationContext.xml"); //System.out.println(context.getBean("a", StudentA.class)); } } 报错如下: caused by: org.springframework.beans.factory.BeanCurrentlyInCreationException...applicationContext.xml"); //System.out.println(context.getBean("a", StudentA.class)); } } 报错 Caused by: org.springframework.beans.factory.BeanCurrentlyInCreationException
org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'testService1...Autowired private TestService1 testService1; public void test2() { } } 从前面得知程序启动会报错,出现了循环依赖: org.springframework.beans.factory.BeanCurrentlyInCreationException
/***************省略其他输出信息**************/ Caused by: org.springframework.beans.factory.BeanCurrentlyInCreationException...Exception in thread "main" org.springframework.beans.factory.BeanCurrentlyInCreationException: Error.../*************省略其他信息**************/ Caused by: org.springframework.beans.factory.BeanCurrentlyInCreationException...Exception in thread "main" org.springframework.beans.factory.BeanCurrentlyInCreationException: Error.../*************省略其他信息**************/ Caused by: org.springframework.beans.factory.BeanCurrentlyInCreationException
这里将调用ServiceA的a1方法"); serviceA.a1(); } } 运行结果 当你运行这个SpringBoot应用的时候,会遇到一个错误,错误信息如下: org.springframework.beans.factory.BeanCurrentlyInCreationException
with name 'timeoutNotifyController': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException...{}}@Servicepublic class B {public B(A a) {}}结果:项目启动失败抛出异常BeanCurrentlyInCreationExceptionCaused by: org.springframework.beans.factory.BeanCurrentlyInCreationException...creating bean with name 'b': Unsatisfied dependency expressed through field 'a'; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException...with name 'timeoutNotifyController': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException