0
votes

Now I'm trying to create Message Service function with kafka to use spring-cloud-stream-bind-kafka, but didn't work so well.

Configuration:
spring boot 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());
    }
}

It failed when I start the project with this error log

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

I'm suspecting my spring boot version. It's so low version.
I think spring-cloud-stream-binder-kafka can't be used under spring boot 2.0 version or other reasons.

I don't know how can I do and how can I explore this situation...
If you give me a little advice, I really appreciate you.

1
I strongly suggest spring boot 2, there has been too many changes. I suggest you to generate the pom starting from start.spring.io for the correct dependencies and versions - Paizo
I also want to use spring boot 2, but I can't(maybe..). Cause this project is really huge legacy - JoonT

1 Answers

1
votes

If you are using Spring Boot 1.4.x version then you should use the Spring Cloud Camden release train.

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

In particular, you should use the following versions:

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