gpt4 book ai didi

java - spring + hibernate 405 不支持删除方法

转载 作者:行者123 更新时间:2023-12-01 09:16:45 25 4
gpt4 key购买 nike

当我通过 http://localhost:8080/cerebromodel/api/skillChecklists/staff/ 访问此功能时{4}/ list /{1}我得到 405。

//delete custom
@RequestMapping(value = "/remove/staff/{sid}/checklist/{cid}", method = DELETE, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Void> deleteStaffChecklist(@PathVariable Long sid,@PathVariable Long cid) throws URISyntaxException {
try {
StaffSkillChecklist ssc = staffSkillChecklistRepository.deleteStaffChecklist(sid, cid);
staffSkillChecklistRepository.delete(ssc.getId());
return ResponseEntity.ok().build();
} catch (Exception x) {
// todo: dig exception, most likely org.hibernate.exception.ConstraintViolationException
return ResponseEntity.status(HttpStatus.CONFLICT).build();
}
}

缺少什么?

最佳答案

您的访问链接是http://localhost:8080/cerebromodel/api/skillChecklists/staff/{4}/checklist/{1}

当处理程序的 URL 提到为

/remove/staff/{sid}/checklist/{cid}

访问链接中缺少删除

关于java - spring + hibernate 405 不支持删除方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40499164/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com