TomcatStarter error with Beans and RabbitTemplate/ RabbitHea



我收到这样的问题,导致我的 gradle 应用程序无法启动:

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:devworkspacedomainapplicationbuildclassesjavamainplnetcmpdomainapplicationconfigRabbitConfig.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());
}

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

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

我完全不知道,从哪里开始解决这样的问题。你遇到过类似的事情吗?

编辑:我想我粘贴的代码与问题无关 - 但我不确定......我完全不知道。

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

  1. 实现春兔依赖
  2. 根据 RabbitProperties 类更改属性文件以建立与 RabbitMQ 的连接
  3. 创建适当的 java 类来启动兔子队列和其他类。

最新更新