RabbitMQ上自动配置的Spring启动失败

RabbitMQ上自动配置的Spring启动失败,spring,rabbitmq,spring-boot,Spring,Rabbitmq,Spring Boot,我有一个大型的Spring启动应用程序,其中包括RabbitMQ。我为兔子队列创建了一个@Configuration文件。这在Spring boot 1.0.2上运行良好。今天我升级了1.1.0版,现在我在启动时遇到了一个异常 问题似乎是HealthIndicator检测到RabbitMQ可用,并尝试为其设置运行状况指示器。然后,由于不能注射兔模板,它立即失败。部分错误消息说,“创建名为'rabbitmplate'的bean时出错:请求的bean当前正在创建中:是否存在无法解析的循环引用?” 下

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

问题似乎是HealthIndicator检测到RabbitMQ可用,并尝试为其设置运行状况指示器。然后,由于不能注射兔模板,它立即失败。部分错误消息说,
“创建名为'rabbitmplate'的bean时出错:请求的bean当前正在创建中:是否存在无法解析的循环引用?”

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

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

这看起来像是Spring Boot中带有新运行状况指示器的bug。我已经长大了


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

您可以发布您的spring配置xml吗?@Larry13767您可以提供一个示例项目并就问题提供一些意见吗#1081?当然,我在我目前的项目上非常匆忙,但如果时间允许的话,我应该可以在这个周末完成。