天天看點

(轉)(記錄)How exactly works the Spring @ResponseBody annotation in this RESTful app

參考:

​​http://stackoverflow.com/questions/28646332/how-exactly-works-the-spring-responsebody-annotation-in-this-restful-applicatio​​

當使用REST的時候,response json,問題是傳回的json是如何對傳回對象處理的?是将對象作為List處理麼?

其實并不是。解答是:

@RequestMapping(value="/orders", method=RequestMethod.GET)
@ResponseBody
public List<Account> accountSummary() {
    return accountManager.getAllAccounts();
}