现在,我尝试用kafka创建Message函数来使用spring-cloud-stream-bind-kafka,但效果不太好。
Configuration:
弹簧引导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-cloud-stream-binder-kafka不能在SpringBoot2.0版本或其他原因下使用。
我不知道我该怎么做,我如何去探索这种情况.
如果你给我一点建议,我真的很感激你。
发布于 2019-06-05 12:35:52
如果您正在使用Spring 1.4.x版本,那么您应该使用Spring发行版。
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"https://stackoverflow.com/questions/56459270
复制相似问题