Spring Cloud Bus with rabbit - 应用程序启动失败

Spring Cloud Bus with rabbit - Application Failed to Start

我正在尝试创建一个配置服务器来侦听 Git 事件并将事件流式传输到客户端。我遵循了几个示例和文档,但我无法启动应用程序。我想我对 spring 引导和云版本有问题。

重要的是要提到 im 运行 rabbitmq with docker.

这是我的build.gradle

plugins {
    id 'org.springframework.boot' version '2.5.3'
    id 'io.spring.dependency-management' version '1.0.11.RELEASE'
    id 'java'
}

group = 'com.pal.pocs.config'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'

configurations {
    compileOnly {
        extendsFrom annotationProcessor
    }
}

repositories {
    mavenCentral()
}

ext {
    set('springCloudVersion', "2020.0.3")
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-actuator'
    implementation 'org.springframework.cloud:spring-cloud-config-server'
    implementation 'org.springframework.cloud:spring-cloud-starter-bus-amqp'
    compileOnly 'org.projectlombok:lombok'
    annotationProcessor 'org.projectlombok:lombok'
    testImplementation 'org.springframework.boot:spring-boot-starter-test'
}

dependencyManagement {
    imports {
        mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
    }
}

test {
    useJUnitPlatform()
}

这是我得到的异常:

***************************
APPLICATION FAILED TO START
***************************

Description:

An attempt was made to call a method that does not exist. The attempt was made from the following location:

    org.springframework.cloud.stream.binder.rabbit.RabbitMessageChannelBinder.createConsumerEndpoint(RabbitMessageChannelBinder.java:517)

The following method did not exist:

    org.springframework.integration.amqp.inbound.AmqpInboundChannelAdapter.<init>(Lorg/springframework/amqp/rabbit/listener/AbstractMessageListenerContainer;)V

The method's class, org.springframework.integration.amqp.inbound.AmqpInboundChannelAdapter, is available from the following locations:

    jar:file:/C:/Users/lambe/.gradle/caches/modules-2/files-2.1/org.springframework.integration/spring-integration-amqp/5.5.2/7195ed265b0f6c24e52c3ed84253f7974b2d5014/spring-integration-amqp-5.5.2.jar!/org/springframework/integration/amqp/inbound/AmqpInboundChannelAdapter.class

The class hierarchy was loaded from the following locations:

    org.springframework.integration.amqp.inbound.AmqpInboundChannelAdapter: file:/C:/Users/lambe/.gradle/caches/modules-2/files-2.1/org.springframework.integration/spring-integration-amqp/5.5.2/7195ed265b0f6c24e52c3ed84253f7974b2d5014/spring-integration-amqp-5.5.2.jar
    org.springframework.integration.endpoint.MessageProducerSupport: file:/C:/Users/lambe/.gradle/caches/modules-2/files-2.1/org.springframework.integration/spring-integration-core/5.5.2/d6822cb2d758d2a5d821879778c31120b4a3c86c/spring-integration-core-5.5.2.jar
    org.springframework.integration.endpoint.AbstractEndpoint: file:/C:/Users/lambe/.gradle/caches/modules-2/files-2.1/org.springframework.integration/spring-integration-core/5.5.2/d6822cb2d758d2a5d821879778c31120b4a3c86c/spring-integration-core-5.5.2.jar
    org.springframework.integration.context.IntegrationObjectSupport: file:/C:/Users/lambe/.gradle/caches/modules-2/files-2.1/org.springframework.integration/spring-integration-core/5.5.2/d6822cb2d758d2a5d821879778c31120b4a3c86c/spring-integration-core-5.5.2.jar
2

Action:

Correct the classpath of your application so that it contains a single, compatible version of org.springframework.integration.amqp.inbound.AmqpInboundChannelAdapter

有人知道配置错误在哪里吗?

嗯,我想通了

我发现 Spring Cloud 2020.0.3 受 Spring Boot 2.4.6

支持

所以我降级到 2.4.6 并开始申请!

希望对其他人有帮助