RabbitMQ上的Autoconfigure的Spring Boot启动失败

时间:2014-06-11 19:34:20

标签: spring rabbitmq spring-boot

我有一个大型的Spring启动应用程序,其中包含RabbitMQ。我为Rabbit队列创建了一个@Configuration文件。这在Spring boot 1.0.2上运行良好。今天我升级了1.1.0版本,现在我在启动时遇到了异常。

问题似乎是HealthIndicator认为RabbitMQ可用并尝试为它设置健康指标。然后它立即失败,因为它无法注入rabbitTemplate。部分错误消息显示为"Error creating bean with name 'rabbitTemplate': Requested bean is currently in creation: Is there an unresolvable circular reference?"

下面包含实际的异常跟踪。

Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'environmentMvcEndpoint' defined in class path resource [org/springframework/boot/actuate/autoconfigure/EndpointWebMvcAutoConfiguration.class]: Unsatisfied dependency expressed through constructor argument with index 0 of type [org.springframework.boot.actuate.endpoint.EnvironmentEndpoint]: : Error creating bean with name 'org.springframework.boot.actuate.autoconfigure.EndpointAutoConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: java.util.Map org.springframework.boot.actuate.autoconfigure.EndpointAutoConfiguration.healthIndicators; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.actuate.autoconfigure.HealthIndicatorAutoConfiguration$RabbitHealthIndicatorConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private java.util.Map org.springframework.boot.actuate.autoconfigure.HealthIndicatorAutoConfiguration$RabbitHealthIndicatorConfiguration.rabbitTemplates; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.cisco.config.queuing.QueuingConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: org.springframework.amqp.rabbit.core.RabbitTemplate com.cisco.config.queuing.QueuingConfiguration.rabbitTemplate; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'rabbitTemplate': Requested bean is currently in creation: Is there an unresolvable circular reference?; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.actuate.autoconfigure.EndpointAutoConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: java.util.Map org.springframework.boot.actuate.autoconfigure.EndpointAutoConfiguration.healthIndicators; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.actuate.autoconfigure.HealthIndicatorAutoConfiguration$RabbitHealthIndicatorConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private java.util.Map org.springframework.boot.actuate.autoconfigure.HealthIndicatorAutoConfiguration$RabbitHealthIndicatorConfiguration.rabbitTemplates; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.cisco.config.queuing.QueuingConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: org.springframework.amqp.rabbit.core.RabbitTemplate com.cisco.config.queuing.QueuingConfiguration.rabbitTemplate; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'rabbitTemplate': Requested bean is currently in creation: Is there an unresolvable circular reference?
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:747) ~[spring-beans-4.0.5.RELEASE.jar!/:4.0.5.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:462) ~[spring-beans-4.0.5.RELEASE.jar!/:4.0.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1094) ~[spring-beans-4.0.5.RELEASE.jar!/:4.0.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:989) ~[spring-beans-4.0.5.RELEASE.jar!/:4.0.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504) ~[spring-beans-4.0.5.RELEASE.jar!/:4.0.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475) ~[spring-beans-4.0.5.RELEASE.jar!/:4.0.5.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:304) ~[spring-beans-4.0.5.RELEASE.jar!/:4.0.5.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228) ~[spring-beans-4.0.5.RELEASE.jar!/:4.0.5.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:300) ~[spring-beans-4.0.5.RELEASE.jar!/:4.0.5.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[spring-beans-4.0.5.RELEASE.jar!/:4.0.5.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:470) ~[spring-beans-4.0.5.RELEASE.jar!/:4.0.5.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:459) ~[spring-beans-4.0.5.RELEASE.jar!/:4.0.5.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.getBeansOfType(AbstractApplicationContext.java:1063) ~[spring-context-4.0.5.RELEASE.jar!/:4.0.5.RELEASE]
at org.springframework.boot.actuate.endpoint.mvc.MvcEndpoints.afterPropertiesSet(MvcEndpoints.java:55) ~[spring-boot-actuator-1.1.0.RELEASE.jar!/:1.1.0.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1612) ~[spring-beans-4.0.5.RELEASE.jar!/:4.0.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1549) ~[spring-beans-4.0.5.RELEASE.jar!/:4.0.5.RELEASE]
... 92 common frames omitted

1 个答案:

答案 0 :(得分:3)

这看起来像是Spring Boot中新的健康指标的错误。我已经提出了https://github.com/spring-projects/spring-boot/issues/1081

在修复之前,您可以通过在HealthIndicatorAutoConfiguration中设置health.rabbit.enabled=false来禁用兔子的application.properties