问题
Trying to use the following example from Spring Docs
@Bean
public MessageConverter userMessageConverter() throws IOException {
AvroSchemaMessageConverter avroSchemaMessageConverter {
return new AvroSchemaMessageConverter(MimeType.valueOf("avro/bytes");
}
Using Gradle as follows
buildscript {
ext {
springBootVersion = '1.4.2.RELEASE'
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
apply plugin: 'org.springframework.boot'
dependencies {
compile('org.springframework.cloud:spring-cloud-stream')
compile('org.springframework.cloud:spring-cloud-starter-stream-kafka')
}
dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:Camden.SR2"
}
}
Gradle is loading the correct version of spring-cloud-streams 1.1.0.RELEASE
but it does not match with the Github Repo. The artifact is missing the org.springframework.cloud.stream.schema
package/source.
Am I missing something here?
回答1:
The artifact org.springframework.cloud:spring-cloud-starter-stream-kafka
brings in spring-cloud-stream
, spring-cloud-stream-codec
and related dependencies like spring-integration
. You would have to explicitly define org.springframework.cloud:spring-cloud-stream-schema
.
Also, you don't need to specify 'org.springframework.cloud:spring-cloud-stream' as it will be part of org.springframework.cloud:spring-cloud-starter-stream-kafka
via org.springframework.cloud:spring-cloud-stream-binder-kafka
.
来源:https://stackoverflow.com/questions/40813184/missing-schema-module-for-spring-cloud-stream