eureka的maven坐标为:org.springframework.cloud:spring-cloud-starter-netflix-eureka-server,其中包含了com.fasterxml.jackson.dataformat:jackson-dataformat-xml的坐标,发现其中没有重复覆盖的依赖为org.codehaus.woodstox:stax2-api,其导致了controller响应数据的类型会被优先转为xml格式,通过http请求头中Accept属性查看application/xml在**;q=0.8,application/signed-exchange;v=b3;q=0.9
解决方法:方法一:
在引入eureka坐标时排除com.fasterxml.jackson.dataformat:jackson-dataformat-xml的坐标
org.springframework.cloud spring-cloud-starter-netflix-eureka-servercom.fasterxml.jackson.dataformat jackson-dataformat-xml
方法二:
在Controller的@RequestMapping(produces = MediaType.APPLICATION_JSON_VALUE)



