The @controller, @RestController, @RequestMapping annotations we used earlier. If you are unfamiliar with spring MVC and have not yet tried the QuickStart case, it is recommended to take a look at Springmvc's annotations first; @Controller: Modifier class, used to create an object to handle an HTTP request @RestController: Spring4 added after the note, the original in the @controller back JSON needs @responsebody to cooperate, 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
Below we try to use spring MVC to implement a set of restful APIs for user object operations, with comments detailing how HTTP requests are mapped in spring MVC, how to pass the parameters, and how to write unit tests.
The RESTful API is specifically designed as follows:
User.java entity class definitions:
01 |
Package com.xiaojingg.domain; |