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.
Similar Posts:
- Springboot uses the Datetimeformat (pattern = “yyyy MM DD HH: mm: SS”) annotation to automatically convert the string to date type error
- [Solved] Cannot deserialize instance of `java.lang.String` out of START_OBJECT token
- Using Vue + Axios: axios.post error: request failed with status code 400 is one of the solutions
- SpringMVC @RequestBody Error:Unrecognized field, not marked as ignorable
- The second parameter of openfit duplicate mapping and openfit interface method is bindingresult Error
- [Solved] react native TypeError: Network request failed Unable to symbolicate stack trace: The stack is null
- Postman reported an error unsupported media type [How to Solve]
- Resolved [org.springframework.web.bind.MissingServletRequestParameterException: Required request parameter ’email’ for method parameter type String is not present]
- When parsing background JSON data with Ajax: unexpected token o in JSON at position 1
- Error Domain=NSCocoaErrorDomain Code=3840 “Invalid value around character 162.” UserInf…