【发布时间】:2020-04-24 23:03:41
【问题描述】:
我有一个问题。是否可以仅更改 PutRequest 中的一个参数? 我在互联网上没有找到任何关于此的内容。
@GetMapping("/templates/{user_name}/{template_id}")
public Template retrieveTemplate(@PathVariable("user_name") String user_name,@PathVariable("template_id") int template_id)
{
return templateRepository.findByTemplateIdAndUserName(template_id, user_name);
}
这是我的 GetRequest,我希望只能更改参数模板。
【问题讨论】:
-
你能改进你的问题吗?我不确定你到底想做什么。
-
好吧,对不起。它有一个名为 Templates 的数据库。在这个数据库中有参数 id、user_name、template_id 和一个字符串模板。当我启动 PutRequest 时,不应允许我更改 id template_id 和 user_name。只有模板应该可以更改。
-
您需要的是 HTTP 中的 PATCH。
标签: java microservices