spring boot 自己输出json数据

@RequestMapping("/json")
public void json(HttpServletResponse response, Pager pager, TruckFee entity) throws IOException{
response.addHeader("Access-Control-Allow-Origin", "*");
response.setHeader("Content-Type", "application/json;charset=UTF-8");
PrintWriter write = response.getWriter();
write.write("{id:100}");
write.flush();
}
posted @ 2017-09-07 12:37  中迁仙人  阅读(538)  评论(0编辑  收藏  举报