Closed dlehammer closed 4 years ago
@dlehammer We are now in 3.0.1 (Horsham.SR1) version and schema-registry has moved to it's own project outside of spring-cloud-stream. So I am going to move this issue there.
Thanks @olegz,
I was wondering where the code had moved, seems my google-fu didn't reveal the new location :)
FYI: seems the symptom is still present in master
SchemaRegistryClientConfiguration.
Error
Utilizing
@EnableSchemaRegistryClient
whilejackson-dataformat-xml
is present on classpath when performing requests to the@EnableSchemaRegistryServer
results in HTTP response:Stacktrace:
Symptom discovered in 2.2.1.RELEASE, still present in 2.2.2.RELEASE.
Cause
SchemaRegistryClientConfiguration.schemaRegistryClient()
initializesnew DefaultSchemaRegistryClient()
, this client implicitly utilizesnew RestTemplate()
.Unfortunately in this case
RestTemplate
behaviour is dictated by the classpath, and whenjackson-dataformat-xml
is present, XML takes precedence over JSON andContent-type
is set toapplication/xml
.Proposed solution
Utilize
RestTemplateBuilder
to generate a JSON compatibleRestTemplate
regardless of classpath configuration.Known work-around
"Duplicate"
SchemaRegistryClientConfiguration
logic and remove@EnableSchemaRegistryClient
, changing the client to utilize theDefaultSchemaRegistryClient(RestTemplate restTemplate)
constructor instead with a JSON compliantRestTemplate
instance.