创建在org.springframework.cloud.stream.config.BinderFactoryAutoConfiguration中定义的名称为'compositeMessageChannelConfigurer'的bean时出错

时间:2020-03-25 07:39:32

标签: spring-boot spring-cloud-stream spring-cloud-stream-binder-kafka

enter image description here

微服务1:

工件ID-microservice1 定义了KafkaStreams.java接口,其中定义了如下所示的活页夹属性。

public interface KafkaStreams {

    String OUTPUT = "kafka-output";

    String INPUT = "kafka-input";

    @Input(INPUT)
    SubscribableChannel getInputChannel();

    @Output(OUTPUT)
    MessageChannel getOutboundMessageChannel();
}

微服务2: 物件ID-microservice2

在微服务2中添加了依赖性微服务1,并为云属性代理提供了conf和主题名称。

spring:
  application:
    name: business-service
  cloud:
    stream:
      default-binder: kafka1
      function:
        definition: 
      kafka:
        binder:
          brokers:
            - localhost:9092
          configuration:
            default.key.serde: org.apache.kafka.common.serialization.Serdes$StringSerde
            default.value.serde: org.apache.kafka.common.serialization.Serdes$BytesSerde
            commit.interval.ms: 1000
            security.protocol: SASL_PLAINTEXT      
      bindings:
        kafka-input:
          destination: topic1
          contentType: text/plain
          binder: kafka1
        kafka-output:
          destination: topic2
          contentType: text/plain
          binder: kafka1      
      binders:
        kafka1:
         type: kafka
         environment:
           spring:
             cloud:
               stream:
                kafka:
                  binder:
                    brokers: localhost:9092

堆栈跟踪:

2020-03-25T15:21:09.748+08:00 [APP/PROC/WEB/0] [OUT] Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'compositeMessageChannelConfigurer' defined in org.springframework.cloud.stream.config.BinderFactoryAutoConfiguration: Unsatisfied dependency expressed through method 'compositeMessageChannelConfigurer' parameter 0; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.springframework.cloud.stream.binding.MessageConverterConfigurer' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
2020-03-25T15:21:09.748+08:00 [APP/PROC/WEB/0] [OUT] at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:798) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
2020-03-25T15:21:09.748+08:00 [APP/PROC/WEB/0] [OUT] at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:539) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
2020-03-25T15:21:09.748+08:00 [APP/PROC/WEB/0] [OUT] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1338) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
2020-03-25T15:21:09.748+08:00 [APP/PROC/WEB/0] [OUT] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1177) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]

0 个答案:

没有答案