就是RESTful api吧,大概…
    大概比较核心的就是 @RestController ,显然是继承的 Controller

    1. @RestController
    2. @RequestMapping("/person")
    3. public class PersonController {
    4. @RequestMapping(method = RequestMethod.GET)
    5. public List<Person> getAllPerson() {
    6. List<Person> l = new ArrayList<>();
    7. l.add(new Person(1, "Chester"));
    8. return l;
    9. }
    10. @RequestMapping(value = "/{id:[\\d]+}", method = RequestMethod.GET)
    11. public Person getPerson(
    12. @PathVariable(value = "id") int id
    13. )
    14. {
    15. return new Person(id, "Chester");
    16. }
    17. }

    它的作用是不用你写 ResponseBody , 可以直接返回Java对象