1

有没有区别

@ResponseBody
public Object method(etc..) {
    etc..
}

public @ResponseBody Object method(etc..){
    etc..
}

?

4

1 回答 1

2

它们之间没有区别。

如果该方法使用 @ResponseBody 注释,则返回类型将写入响应 HTTP 正文。返回值将使用 HttpMessageConverters 转换为声明的方法参数类型

http://static.springsource.org/spring/docs/3.0.x/reference/mvc.html#mvc-ann-responsebody

于 2013-04-24T20:26:15.683 回答