2014-06-11 93 views
2

我有一个大的Spring引导应用程序,其中包括RabbitMQ。我为Rabbit队列创建了一个@Configuration文件。这一直在Spring引导1.0.2正常工作。今天我升级了版本1.1.0,现在我在启动时遇到了异常。Spring引导启动失败,在RabbitMQ上自动配置

问题似乎是,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

你可以发布你的弹簧配置xml吗? – fmodos

回答

3

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

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

+0

@ Larry13767你能否提供一个样本项目并对问题#1081提供一些意见? –

+0

当然,我在当前的项目上相当忙,但如果时间确定的话,我应该可以在本周末做到这一点。 – EvilJinious1