spring 云流绑定 kafka 不工作

spring cloud stream binder kafka doesn't work

现在我正在尝试使用 kafka 创建消息服务功能以使用 spring-cloud-stream-bind-kafka,但效果不佳。

Configuration:
spring 引导 1.4.2

build.gradle:

compile "org.springframework.cloud:spring-cloud-stream:2.0.1.RELEASE"
compile "org.springframework.cloud:spring-cloud-stream-binder-kafka:2.0.1.RELEASE"

code:

@EnableBindings(MessagePublish.class)
class MessageConfiguration {
}

interface MessagePublish {
    @Output("test")
    MessageChannel publish();
}

class TestService {
    @Autowired
    MessagePublish messagePublish;

    public void doSomething() {
        // do something
        messagePublish.publish().send(MessageBuilder.withPayload("test").build());
    }
}

启动项目失败,出现此错误日志

Caused by: org.springframework.boot.autoconfigure.condition.OnBeanCondition$BeanTypeDeductionException: Failed to deduce bean type for org.springframework.cloud.stream.config.BindingServiceConfiguration.bindingService
....
Caused by: java.lang.ClassNotFoundException: org.springframework.integration.support.converter.ConfigurableCompositeMessageConverter

我怀疑我的 spring 引导版本。版本太低了
我觉得spring-cloud-stream-binder-kafka不能在springboot 2.0版本下使用或者其他原因。

我不知道我该怎么办,我该如何探索这种情况...
如果你能给我一点建议,我真的很感激你。

如果您使用的是 Spring Boot 1.4.x 版本,那么您应该使用 Spring Cloud Camden 发行版。

https://github.com/spring-projects/spring-cloud/wiki/Spring-Cloud-Camden-Release-Notes

特别是,您应该使用以下版本:

compile "org.springframework.cloud:spring-cloud-stream:1.1.2.RELEASE"
compile "org.springframework.cloud:spring-cloud-stream-binder-kafka:1.1.2.RELEASE"