content negotiation using spring mvc
元数据管理平台的REST接口突然抽风,总是返回XML格式,不管我怎么设置accept头。Debug了一下,发现每次都是优先使用ServletPathExtensionContentNegotitionStrategy。谷歌了一下,原来Spring默认的三个ContentNegotiationStrategy是PPA Strategy (path extension, then parameter, then Accept header) ,顺便也是先path extension,然后parameter(默认是format参数),然后才是accept头。要让Spring使用accept头解析,只要配置一下ContentNegotiationManagerFactory...