**关闭。**此题需要debugging details。目前不接受答复。
编辑问题以包含desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem。这将帮助其他人回答这个问题。
54分钟前关闭
Improve this question
@RestController
public class userController {
@Autowired
userRepo Userrepo;
@PostMapping("/user1")
public userModel createUser(@RequestBody userModel user)
{
user.setUserId(111);
user.setUserName("sury");
user.setUserEmail("sury@gmail.com");
user.setUserPass("LeoLeo");
return Userrepo.save(user);
}
我试图将数据存储在数据库中,但它显示GET不支持错误。
1条答案
按热度按时间hs1rzwqc1#
您使用了注解@PostMapping,该注解用于将请求与POST方法Map,您尝试使用GET方法使用请求访问此路径,尝试使用POST方法使用请求,或者切换到注解@GetMapping