首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >弹簧集成:粘合剂配置(用于兔子)

弹簧集成:粘合剂配置(用于兔子)
EN

Stack Overflow用户
提问于 2019-07-12 13:37:20
回答 1查看 1.9K关注 0票数 0

我正在尝试将Spring集成应用程序配置为中间件。

下面是application.yml文件:

代码语言:javascript
复制
spring:
  application:
    name: ${vcap.application.name:}
  cloud:
    stream:
      bindings:
        myOutput:
          destination: myInput
      default-binder: rabbit

我得到的错误是:

代码语言:javascript
复制
nested exception is java.lang.IllegalStateException: Unknown binder configuration: rabbit

任何想法,如何正确配置兔的冲刺集成。

该项目被划分为多个模块,我得到了这段代码,形成了以前开发的一个组织。因此,我可能无法回答所有的“为什么”问题,但以下是:

模块1:源级文件:

代码语言:javascript
复制
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'maven'
apply plugin: 'maven-publish'
apply plugin: 'io.spring.dependency-management'

dependencies {
    compile project(':mds-dealer-redcap-common')

    // spring dependencies
    compile 'org.springframework.boot:spring-boot-starter-web'
    compile 'org.springframework.boot:spring-boot-starter-amqp'
    compile 'org.springframework.boot:spring-boot-starter-actuator'
    // https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-starter-stream-rabbit
    compile 'org.springframework.cloud:spring-cloud-stream'


    // https://mvnrepository.com/artifact/org.springframework.cloud.stream.app/spring-cloud-starter-stream-source-time
    compile 'org.springframework.cloud.stream.app:spring-cloud-starter-stream-source-time:2.0.0.RC1'
}

模块2:同步分级文件

代码语言:javascript
复制
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'maven'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'maven-publish'

dependencies {
    compile project(':mds-dealer-redcap-common')

    // spring dependencies
    compile 'org.springframework.boot:spring-boot-starter-web'
    compile 'org.springframework.boot:spring-boot-starter-amqp'
    compile 'org.springframework.boot:spring-boot-starter-actuator'
    compile 'org.springframework.cloud:spring-cloud-starter-stream-rabbit'


    //core common modules
    compile ('common:common-domain:latest.integration')


    // database dependencies
    compile('org.springframework.boot:spring-boot-starter-data-mongodb')
//    compile 'org.springframework.data:spring-data-mongodb:1.10.0.RELEASE'


    // others
    compile 'org.glassfish.jersey.core:jersey-client:2.23'

    //Logging dependency
    compile 'org.slf4j:slf4j-api'

    //test dependencies
    testCompile 'org.springframework.boot:spring-boot-starter-test:2.1.5.RELEASE'
    testCompile 'junit:junit:4.12'
}

模块3:处理器

代码语言:javascript
复制
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'maven'
apply plugin: 'maven-publish'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
dependencies {
    compile project(':mds-dealer-redcap-common')

    // spring dependencies
    compile 'org.springframework.boot:spring-boot-starter-web'
    compile 'org.springframework.boot:spring-boot-starter-amqp'
    compile 'org.springframework.boot:spring-boot-starter-actuator'
    compile 'org.springframework.cloud:spring-cloud-starter-stream-rabbit'

    compile 'org.glassfish.jersey.core:jersey-client:2.23'

    //core common modules
    compile ('common:common-domain:latest.integration')

    // database dependencies
    compile('org.springframework.boot:spring-boot-starter-data-mongodb')
//    compile 'org.springframework.data:spring-data-mongodb:1.10.0.RELEASE'


    //Logging dependency
    compile 'org.slf4j:slf4j-api'

    //test dependencies
    testCompile 'org.springframework.boot:spring-boot-starter-test'
    testCompile 'junit:junit:4.12'
}

主要应用程序Gradle代码片段:

代码语言:javascript
复制
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'maven-publish'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
apply plugin: "io.spring.dependency-management"dependencies {
    compile project(':mds-dealer-redcap-common'), project(':mds-dealer-redcap-source'), project(':mds-dealer-redcap-processor'), project(':mds-dealer-redcap-sink')

    // spring dependencies
    compile 'org.springframework.cloud:spring-cloud-starter-stream-rabbit'
    compile 'org.springframework.cloud:spring-cloud-stream'
    compile 'org.springframework.boot:spring-boot-configuration-processor'
    compile 'org.springframework.boot:spring-boot-starter-actuator'  
    compile('common:responseheaders:latest.integration'){ changing=true }

    compile 'org.slf4j:slf4j-api:1.7.21'
    testCompile 'org.springframework.boot:spring-boot-starter-test'
    testCompile 'junit:junit:4.12'
}

这一切是如何开始的:

代码语言:javascript
复制
public static void main(String[] args) {
 new AggregateApplicationBuilder(DealerRedcapIngestionStarter.class)
                .from(StreamTrigger.class)
                .via(DealerRedcapProcessor.class)
                .to(DealerRedcapSink.class).run(args);
    }

对于依赖项的版本,我将使用以下内容:

代码语言:javascript
复制
dependencyManagement {
    imports {
        mavenBom 'org.springframework.cloud:spring-cloud-dependencies:Greenwich.SR1'
        mavenBom "org.springframework.boot:spring-boot-starter:${springBootVersion}"

    }
}

春季引导版本为2.1.5。

EN

回答 1

Stack Overflow用户

发布于 2019-07-12 13:44:29

除非类路径上有多个绑定器,否则实际上不需要default-binder属性-请参阅参考指南

但是,此错误意味着类路径上没有兔子绑定器。

代码语言:javascript
复制
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-stream-binder-rabbit</artifactId>
    </dependency>

编辑

下面是start.spring.io在选择Spring Cloud StreamSpring for RabbitMQ时构建的初始Spring Cloud Stream

代码语言:javascript
复制
plugins {
    id 'org.springframework.boot' version '2.1.6.RELEASE'
    id 'java'
}

apply plugin: 'io.spring.dependency-management'

group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'

repositories {
    mavenCentral()
}

ext {
    set('springCloudVersion', "Greenwich.SR2")
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-amqp'
    implementation 'org.springframework.cloud:spring-cloud-stream'
    implementation 'org.springframework.cloud:spring-cloud-stream-binder-rabbit'
    testImplementation 'org.springframework.boot:spring-boot-starter-test'
    testImplementation 'org.springframework.cloud:spring-cloud-stream-test-support'
}

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

这些是由此产生的依赖性..。

代码语言:javascript
复制
compileClasspath - Compile classpath for source set 'main'.
+--- org.springframework.boot:spring-boot-starter-amqp -> 2.1.6.RELEASE
|    +--- org.springframework.boot:spring-boot-starter:2.1.6.RELEASE
|    |    +--- org.springframework.boot:spring-boot:2.1.6.RELEASE
|    |    |    +--- org.springframework:spring-core:5.1.8.RELEASE
|    |    |    |    \--- org.springframework:spring-jcl:5.1.8.RELEASE
|    |    |    \--- org.springframework:spring-context:5.1.8.RELEASE
|    |    |         +--- org.springframework:spring-aop:5.1.8.RELEASE
|    |    |         |    +--- org.springframework:spring-beans:5.1.8.RELEASE
|    |    |         |    |    \--- org.springframework:spring-core:5.1.8.RELEASE (*)
|    |    |         |    \--- org.springframework:spring-core:5.1.8.RELEASE (*)
|    |    |         +--- org.springframework:spring-beans:5.1.8.RELEASE (*)
|    |    |         +--- org.springframework:spring-core:5.1.8.RELEASE (*)
|    |    |         \--- org.springframework:spring-expression:5.1.8.RELEASE
|    |    |              \--- org.springframework:spring-core:5.1.8.RELEASE (*)
|    |    +--- org.springframework.boot:spring-boot-autoconfigure:2.1.6.RELEASE
|    |    |    \--- org.springframework.boot:spring-boot:2.1.6.RELEASE (*)
|    |    +--- org.springframework.boot:spring-boot-starter-logging:2.1.6.RELEASE
|    |    |    +--- ch.qos.logback:logback-classic:1.2.3
|    |    |    |    +--- ch.qos.logback:logback-core:1.2.3
|    |    |    |    \--- org.slf4j:slf4j-api:1.7.25 -> 1.7.26
|    |    |    +--- org.apache.logging.log4j:log4j-to-slf4j:2.11.2
|    |    |    |    +--- org.slf4j:slf4j-api:1.7.25 -> 1.7.26
|    |    |    |    \--- org.apache.logging.log4j:log4j-api:2.11.2
|    |    |    \--- org.slf4j:jul-to-slf4j:1.7.26
|    |    |         \--- org.slf4j:slf4j-api:1.7.26
|    |    +--- javax.annotation:javax.annotation-api:1.3.2
|    |    \--- org.springframework:spring-core:5.1.8.RELEASE (*)
|    +--- org.springframework:spring-messaging:5.1.8.RELEASE
|    |    +--- org.springframework:spring-beans:5.1.8.RELEASE (*)
|    |    \--- org.springframework:spring-core:5.1.8.RELEASE (*)
|    \--- org.springframework.amqp:spring-rabbit:2.1.7.RELEASE
|         +--- org.springframework.amqp:spring-amqp:2.1.7.RELEASE
|         |    +--- org.springframework:spring-core:5.1.8.RELEASE (*)
|         |    \--- org.springframework.retry:spring-retry:1.2.4.RELEASE
|         |         \--- org.springframework:spring-core:4.3.22.RELEASE -> 5.1.8.RELEASE (*)
|         +--- com.rabbitmq:amqp-client:5.4.3
|         |    \--- org.slf4j:slf4j-api:1.7.25 -> 1.7.26
|         +--- org.springframework:spring-context:5.1.8.RELEASE (*)
|         +--- org.springframework:spring-messaging:5.1.8.RELEASE (*)
|         \--- org.springframework:spring-tx:5.1.8.RELEASE
|              +--- org.springframework:spring-beans:5.1.8.RELEASE (*)
|              \--- org.springframework:spring-core:5.1.8.RELEASE (*)
+--- org.springframework.cloud:spring-cloud-stream -> 2.1.3.RELEASE
|    +--- org.springframework.boot:spring-boot-starter-validation:2.1.3.RELEASE -> 2.1.6.RELEASE
|    |    +--- org.springframework.boot:spring-boot-starter:2.1.6.RELEASE (*)
|    |    +--- org.apache.tomcat.embed:tomcat-embed-el:9.0.21
|    |    \--- org.hibernate.validator:hibernate-validator:6.0.17.Final
|    |         +--- javax.validation:validation-api:2.0.1.Final
|    |         +--- org.jboss.logging:jboss-logging:3.3.2.Final
|    |         \--- com.fasterxml:classmate:1.3.4 -> 1.4.0
|    +--- org.springframework:spring-messaging:5.1.5.RELEASE -> 5.1.8.RELEASE (*)
|    +--- org.springframework.integration:spring-integration-core:5.1.3.RELEASE -> 5.1.6.RELEASE
|    |    +--- org.springframework:spring-core:5.1.8.RELEASE (*)
|    |    +--- org.springframework:spring-aop:5.1.8.RELEASE (*)
|    |    +--- org.springframework:spring-context:5.1.8.RELEASE (*)
|    |    +--- org.springframework:spring-messaging:5.1.8.RELEASE (*)
|    |    +--- org.springframework:spring-tx:5.1.8.RELEASE (*)
|    |    +--- org.springframework.retry:spring-retry:1.2.4.RELEASE (*)
|    |    \--- io.projectreactor:reactor-core:3.2.10.RELEASE
|    |         \--- org.reactivestreams:reactive-streams:1.0.2
|    +--- org.springframework.integration:spring-integration-jmx:5.1.3.RELEASE -> 5.1.6.RELEASE
|    |    \--- org.springframework.integration:spring-integration-core:5.1.6.RELEASE (*)
|    +--- org.springframework:spring-tuple:1.0.0.RELEASE
|    |    +--- com.esotericsoftware:kryo-shaded:3.0.3
|    |    |    +--- com.esotericsoftware:minlog:1.3.0
|    |    |    \--- org.objenesis:objenesis:2.1
|    |    +--- org.springframework:spring-core:4.2.6.RELEASE -> 5.1.8.RELEASE (*)
|    |    +--- com.fasterxml.jackson.core:jackson-databind:2.6.6 -> 2.9.9
|    |    |    +--- com.fasterxml.jackson.core:jackson-annotations:2.9.0
|    |    |    \--- com.fasterxml.jackson.core:jackson-core:2.9.9
|    |    \--- org.springframework:spring-context:4.2.6.RELEASE -> 5.1.8.RELEASE (*)
|    +--- org.springframework.integration:spring-integration-tuple:1.0.0.RELEASE
|    |    +--- org.springframework:spring-tuple:1.0.0.RELEASE (*)
|    |    \--- org.springframework.integration:spring-integration-core:4.2.5.RELEASE -> 5.1.6.RELEASE (*)
|    +--- org.springframework.retry:spring-retry:1.2.4.RELEASE (*)
|    \--- org.springframework.cloud:spring-cloud-function-context:2.0.1.RELEASE -> 2.0.2.RELEASE
|         +--- org.springframework.boot:spring-boot-autoconfigure:2.1.3.RELEASE -> 2.1.6.RELEASE (*)
|         +--- org.springframework.cloud:spring-cloud-function-core:2.0.2.RELEASE
|         |    +--- io.projectreactor:reactor-core:3.2.6.RELEASE -> 3.2.10.RELEASE (*)
|         |    \--- org.springframework:spring-core:5.1.5.RELEASE -> 5.1.8.RELEASE (*)
|         \--- org.springframework:spring-messaging:5.1.5.RELEASE -> 5.1.8.RELEASE (*)
\--- org.springframework.cloud:spring-cloud-stream-binder-rabbit -> 2.1.3.RELEASE
     +--- org.springframework.cloud:spring-cloud-stream-binder-rabbit-core:2.1.3.RELEASE
     |    +--- org.springframework.cloud:spring-cloud-stream:2.1.3.RELEASE (*)
     |    +--- org.springframework.boot:spring-boot-starter-amqp:2.1.3.RELEASE -> 2.1.6.RELEASE (*)
     |    +--- org.springframework.integration:spring-integration-amqp:5.1.3.RELEASE -> 5.1.6.RELEASE
     |    |    +--- org.springframework.integration:spring-integration-core:5.1.6.RELEASE (*)
     |    |    \--- org.springframework.amqp:spring-rabbit:2.1.7.RELEASE (*)
     |    +--- org.springframework:spring-web:5.1.5.RELEASE -> 5.1.8.RELEASE
     |    |    +--- org.springframework:spring-beans:5.1.8.RELEASE (*)
     |    |    \--- org.springframework:spring-core:5.1.8.RELEASE (*)
     |    +--- org.apache.httpcomponents:httpclient:4.5.7 -> 4.5.9
     |    |    +--- org.apache.httpcomponents:httpcore:4.4.11
     |    |    \--- commons-codec:commons-codec:1.11
     |    \--- com.rabbitmq:http-client:2.1.0.RELEASE
     |         \--- com.fasterxml.jackson.core:jackson-databind:2.9.5 -> 2.9.9 (*)
     +--- org.springframework.cloud:spring-cloud-stream:2.1.3.RELEASE (*)
     +--- org.springframework.boot:spring-boot-starter-amqp:2.1.3.RELEASE -> 2.1.6.RELEASE (*)
     +--- org.springframework.integration:spring-integration-amqp:5.1.3.RELEASE -> 5.1.6.RELEASE (*)
     +--- org.springframework.integration:spring-integration-core:5.1.3.RELEASE -> 5.1.6.RELEASE (*)
     +--- org.springframework.integration:spring-integration-jmx:5.1.3.RELEASE -> 5.1.6.RELEASE (*)
     \--- org.apache.httpcomponents:httpclient:4.5.6 -> 4.5.9 (*)
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/57008105

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档