Spring MVC:ProducesRequestCondition无法正常工作?

时间:2016-09-23 19:55:07

标签: java spring-mvc

请考虑以下代码:

@GetMapping(path = "/images/{id}", produces = "application/json")
public Image get(@PathVariable String domain, @PathVariable String id) {
    // Return Image object here
}

@GetMapping(path = "/images/{id}", produces = "!application/json")
public byte[] getBytes(@PathVariable String domain, @PathVariable String id) {
    // Return Byte array here
}

如果我添加标题"接受:* / *"对于请求,两个映射都匹配 但是如果我添加标题"接受:* / *; q = 0.8"对于请求,只匹配第一个映射。

0 个答案:

没有答案