This example scenario: using the postman tool to access http://localhost The corresponding background method of 8080/user/insert is the following code
@RestController
@RequestMapping("/user")
public class UserController {
@Autowired
private UserMapper userMapper;
@PostMapping("/insert")
public int insert(@RequestBody User user) {
return userMapper.insert(user);
}
}
Parsing: when you add @ requestbody to the background method parameters, you need JSON (application/JSON) format to encapsulate the request parameters into user objects. Solution: you can access it normally by setting the following in postman, which is convenient for debugging.