The @controller, @RestController, @RequestMapping annotations we used before. If you are unfamiliar with spring MVC and have not tried a QuickStart case, it is advisable to look at the SPRINGMVC annotation first; @Controller: Modifier class, which is used to create an object that handles HTTP requests @RestController: Annotations added after Spring4, the original return of JSON in @controller requires @responsebody to match, If you replace @controller directly with @restcontroller, you do not need to configure @responsebody, which returns the JSON format by default. @RequestMapping: Configuring URL Mappings
Here we try to use spring MVC to implement a set of restful APIs to manipulate the user object, with annotations detailing how HTTP requests are mapped in spring MVC, how to pass parameters, and how to write unit tests.
The RESTful API is specifically designed as follows:
User.java entity class definition:
01 |
Package com.xiaojingg.domain; |