Bean和RabbitTemplate / RabbitHealth

时间:2018-06-12 12:53:20

标签: java spring-boot gradle rabbitmq

我收到了这样的问题,这使我的gradle app无法启动:

2018-06-12 14:34:21,995 ERROR org.springframework.boot.web.embedded.tomcat.TomcatStarter [localhost-startStop-1] [] [application] Error starting Tomcat context. Exception: org.springframework.beans.factory.BeanCreationException. Message: Error creating bean with name 'servletEndpointRegistrar' defined in class path resource [org/springframework/boot/actuate/autoconfigure/endpoint/web/ServletEndpointManagementContextConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.actuate.endpoint.web.ServletEndpointRegistrar]: Factory method 'servletEndpointRegistrar' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'healthEndpoint' defined in class path resource [org/springframework/boot/actuate/autoconfigure/health/HealthEndpointConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.actuate.health.HealthEndpoint]: Factory method 'healthEndpoint' threw exception; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.actuate.autoconfigure.amqp.RabbitHealthIndicatorAutoConfiguration': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'rabbitConfig' defined in file [C:\dev\workspace\domain\application\build\classes\java\main\pl\net\cmp\domain\application\config\RabbitConfig.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.boot.context.properties.ConfigurationPropertiesBindException: Error creating bean with name 'domain.application-pl.net.cmp.domain.application.config.applicationProperties': Could not bind properties to 'applicationProperties' : prefix=domain.application, ignoreInvalidFields=false, ignoreUnknownFields=true; nested exception is org.springframework.boot.context.properties.bind.BindException: Failed to bind properties under 'domain.application' to pl.net.cmp.domain.application.config.applicationProperties

我的属性似乎没问题(我已经制作了一个配置文件,将yaml映射到java类)1-1。

我也有:

@Bean
public RabbitTemplate rabbitTemplate() {
    log.info("Initializing rabbitTemplate");
    return new RabbitTemplate(cachingConnectionFactory());
}

我正在使用gradle的最新版本amqp依赖:

compile group: 'org.springframework.boot', name: 'spring-boot-starter-amqp', version: '2.0.2.RELEASE'

我完全不知道,从哪里开始遇到这样的问题。你见过类似的东西吗?

编辑:我想我粘贴的代码与问题无关 - 但我不确定......我完全没有任何想法。

1 个答案:

答案 0 :(得分:0)

固定。 当你进行这样的沟通时,你应该

  1. 实施spring-rabbit依赖
  2. 根据RabbitProperties类更改属性文件以与RabbitMQ建立连接
  3. 创建适当的java类以启动Rabbit Queues和其他人。
相关问题