Spring Cloud版本Hoxton.SR5默认提供XML格式作为HTTP响应 [英] Spring Cloud version Hoxton.SR5 is giving XML format as HTTP response by default
问题描述
当我在Spring Boot应用程序中使用<spring-cloud.version>Hoxton.SR5</spring-cloud.version>
时,默认情况下它将以HTTP响应的形式返回XML格式:
When I am using <spring-cloud.version>Hoxton.SR5</spring-cloud.version>
in my Spring Boot application it is returning me an XML format in the HTTP response by default:
<List>
<item>
<productId>1</productId>
<productName>Samsung LED TV</productName
<quantity>100</quantity
<itemType>TV</itemType>
<itemGroup>Entertainement</itemGroup>
</item>
</List>
当我使用<spring-cloud.version>Hoxton.SR3</spring-cloud.version>
时,它返回JSON格式:
And When I am using <spring-cloud.version>Hoxton.SR3</spring-cloud.version>
, it is returning JSON Format:
[
{
"productId": 1,
"productName": "Samsung LED TV",
"quantity": 100,
"itemType": "TV",
"itemGroup": "Entertainement"
}
]
Hoxton.SR5
对默认情况下返回XML格式的更改有哪些?如何确保使用Hoxton.SR5
时获得JSON格式?
What are the changes made in Hoxton.SR5
that it is returning XML format by default and how can I make sure that I get JSON format while using Hoxton.SR5
?.
推荐答案
在我的案例中,这是由于eureka-client升级导致将jackson-dataformat-xml引入类路径.
In my case it was caused by eureka-client upgrade which brought jackson-dataformat-xml to the classpath.
这篇关于Spring Cloud版本Hoxton.SR5默认提供XML格式作为HTTP响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!