返回
text/plain(例如,从Spring MVC 3 Controller返回仅字符串消息),或者将String包装为某个对象
public class StringResponse { private String response; public StringResponse(String s) { this.response = s; } // get/set omitted...}将你的响应类型设置为MediaType.APPLICATION_JSON_VALUE(= “application/json”)
@RequestMapping(value = "/getString", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
并且你将拥有一个类似于
{ "response" : "your string value" }


