Try this code:
@RequestMapping(method = RequestMethod.GET)
public @ResponseBody MyObj getJSON() {
MyObj obj = new MyObj();
return obj;
}
Put jackson
in your classpath and @ResponseBody
annotation in controller method handler.
Also enable mvc:annotation-driven
in your servlet config.
In this case MyObj will be serialized in JSON format.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…