1.只需引入jackson-mapper-asl(org.codehaus.jackson)包后,在controller中增加此方法,即可实现rest:
import im.gsj.about.vo.RestVo;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
public class RestConstroller {
@RequestMapping(value="/RestConstroller/rest.do", method=RequestMethod.GET)
public @ResponseBody RestVo aboutUs(){
RestVo restVo= new RestVo();
restVo.setId("id");
restVo.setName("myname");
return restVo;
}
}