示例代码
@RestController
@RequestMapping(value = "/api", method = RequestMethod.GET)
public class ApiController {
@RequestMapping(value = "/get")
@ResponseBody
public HashMap<String, Object> get(@RequestParam String name) {
HashMap<String, Object> map = new HashMap<String, Object>();
map.put("title", "hello world");
map.put("name", name);
return map;
}
@RequestMapping(value = "/getname")
@ResponseBody
public HashMap<String, Object> getname(@RequestParam String name) {
HashMap<String, Object> map = new HashMap<String, Object>();
map.put("title", "hello world");
map.put("name", name);
return map;
}
}