创建名称为'eurekaInstanceConfigBean'的bean时出错:在破坏该工厂的singleton时不允许创建singleton bean [英] Error creating bean with name 'eurekaInstanceConfigBean': Singleton bean creation not allowed while singletons of this factory are in destruction
问题描述
此问题是的扩展Eureka Clients以编程方式发行-已完全关闭DiscoveryClient .在我的Windows机器上,JAVA_HOME
和PATH
的两个版本都不同.我只是更正了它,现在它向我显示了下面的错误.
This question is extension of Working With Eureka Clients Programmatically issue - Completed shut down of DiscoveryClient. On my windows machine JAVA_HOME
and PATH
both versions where different. I just corrected it and now its showing me below error.
错误:
对名称为'scopedTarget.eurekaClient'的bean的销毁方法的调用失败:org.springframework.beans.factory.BeanCreationNotAllowedException:创建名称为'eurekaInstanceConfigBean'的bean的错误:在销毁该工厂的单例时不允许创建单例bean (不要在destroy方法的实现中向BeanFactory请求Bean!)
Invocation of destroy method failed on bean with name 'scopedTarget.eurekaClient': org.springframework.beans.factory.BeanCreationNotAllowedException: Error creating bean with name 'eurekaInstanceConfigBean': Singleton bean creation not allowed while singletons of this factory are in destruction (Do not request a bean from a BeanFactory in a destroy method implementation!)
我已经遍历了以下网址:使用名称创建bean时出错并且不允许创建Singleton bean 和 https://github.com/spring-cloud/spring-cloud-netflix/issues/1064 ,但这些建议尚不清楚.
I already went through the urls like :Error creating bean with name and Singleton bean creation not allowed and https://github.com/spring-cloud/spring-cloud-netflix/issues/1064, but these suggestions are not clear.
完整的错误跟踪:
2018-12-28 19:44:02.188 INFO 22184 --- [ Thread-6] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@dc9876b: startup date [Fri Dec 28 19:43:59 IST 2018]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@6e20b53a
2018-12-28 19:44:02.188 INFO 22184 --- [ Thread-6] o.s.c.n.e.s.EurekaServiceRegistry : Unregistering application MYCLIENT with eureka with status DOWN
2018-12-28 19:44:02.188 WARN 22184 --- [ Thread-6] com.netflix.discovery.DiscoveryClient : Saw local status change event StatusChangeEvent [timestamp=1546006442188, current=DOWN, previous=UP]
2018-12-28 19:44:02.188 INFO 22184 --- [ Thread-6] o.s.c.support.DefaultLifecycleProcessor : Stopping beans in phase 0
2018-12-28 19:44:02.190 INFO 22184 --- [ Thread-6] o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed beans on shutdown
2018-12-28 19:44:02.190 INFO 22184 --- [ Thread-6] o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed beans
2018-12-28 19:44:02.192 INFO 22184 --- [ Thread-6] com.netflix.discovery.DiscoveryClient : Shutting down DiscoveryClient ...
2018-12-28 19:44:02.194 WARN 22184 --- [ Thread-6] .s.c.a.CommonAnnotationBeanPostProcessor : Invocation of destroy method failed on bean with name 'scopedTarget.eurekaClient': org.springframework.beans.factory.BeanCreationNotAllowedException: Error creating bean with name 'eurekaInstanceConfigBean': Singleton bean creation not allowed while singletons of this factory are in destruction (Do not request a bean from a BeanFactory in a destroy method implementation!)
推荐答案
您只需要添加 web 依赖项.我不清楚为什么添加 web 依赖项可以解决/解决此问题.
You simply need to add the web dependency. I am not clear why with the addition of web dependencies works/solves this issue.
这篇关于创建名称为'eurekaInstanceConfigBean'的bean时出错:在破坏该工厂的singleton时不允许创建singleton bean的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!