问题
Typical Spring Boot application.
I see that in Jackson2CodeSupport.java
class returns false
all the type.
Because it does not support application/xml
,
only application/json
(the mimeTypes
does not contain xml one)
protected boolean supportsMimeType(@Nullable MimeType mimeType) {
return (mimeType == null || this.mimeTypes.stream().anyMatch(m -> m.isCompatibleWith(mimeType)));
}
I do have the dependency.
com.fasterxml.jackson.dataformat jackson-dataformat-xml 2.9.4
In my code, it starts from building the webClient.
val webClient = webClientBuilder
.baseUrl(endpoint.getUrl())
.defaultHeader(
HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_XML_VALUE,
HttpHeaders.CONTENT_ENCODING, "UTF-8"
)
.filter(logRequest())
//.exchangeStrategies(exchangeStrategies)
.build();
How to make Jackson2CodeSupport to support the XML? What do I miss..
来源:https://stackoverflow.com/questions/54223494/how-to-make-jackson2codesupport-to-support-the-xml