问题
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.
Error:
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!)
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.
The complete error trace:
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!)
回答1:
You simply need to add the web dependency. I am not clear why with the addition of web dependencies works/solves this issue.
来源:https://stackoverflow.com/questions/53959982/error-creating-bean-with-name-eurekainstanceconfigbean-singleton-bean-creatio