我有这个端点调用我的服务方法,然后调用我的 repo 类来删除用户,但是当我通过邮递员调用这个端点时,我得到一个请求方法不支持”打印在控制台中,任何帮助将不胜感激
@RequestMapping(value = "/{useId}/delete-user", method = RequestMethod.DELETE)
public ResponseEntity<String> deleteUser(@PathVariable("userId") String userId){
ResponseEntity<String> response = null;
try {
validate(userId);
userService.deleteUser(Long.parseLong(userId));
response = new ResponseEntity<String>(HttpStatus.NO_CONTENT);
}catch (InputMismatchException e){
response = new ResponseEntity<String>(HttpStatus.BAD_REQUEST);
} catch (UserNotFoundException e) {
response = new ResponseEntity<String>(HttpStatus.NOT_FOUND);
} catch (AccessDeniedException e) {
response = new ResponseEntity<String>(HttpStatus.FORBIDDEN);
}
return response;
}
收到的消息是Request method 'DELETE' not supported