代码之家  ›  专栏  ›  技术社区  ›  xross

Beans和RabbitTemplate/RabbitHealth的TomcatStarter错误

  •  0
  • xross  · 技术社区  · 6 年前

    我遇到了这样的问题,这使得我的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:\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
    

    我还有:

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

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

    我完全不知道从哪里着手解决这样的问题。你见过类似的人吗?

    编辑:我想我粘贴的代码没有连接到问题-但我不确定。。。我完全不知道。

    1 回复  |  直到 6 年前
        1
  •  0
  •   xross    6 年前

    固定的。 当你有这样的交流时,你应该

    1. 实现spring rabbit依赖
    2. 根据RabbitProperties类更改属性文件以建立与RabbitMQ的连接