How to make Jackson2CodeSupport to support the XML

陌路散爱 提交于 2019-12-11 18:55:31

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!