org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'DELETE' not supported
时间: 2023-11-09 16:35:59 浏览: 35
这个异常通常表示你使用了不被支持的 HTTP 请求方法,比如在一个只支持 GET 和 POST 方法的接口中使用了 DELETE 方法。要解决这个问题,你需要检查你的代码,确保使用的请求方法是被接口支持的。如果你确定请求方法是正确的,那么可能是服务器没有正确地配置支持这个请求方法,这时你需要联系服务器管理员进行配置。
相关问题
Resolved [org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'DELETE' not supported]
Resolved [org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'DELETE' not supported]表示请求方法不支持删除操作。根据引用中的代码示例,可以看出在该代码中只有一个RequestMapping注解,且该注解指定了"GET"方法。因此,对于其他方法(例如DELETE),该方法是不支持的。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [报错:Resolved [org.springframework.web.HttpRequestMethodNotSupportedException: Request method ...](https://blog.csdn.net/m0_52861000/article/details/130489613)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *2* [Resolved [org.springframework.web.HttpRequestMethodNotSupportedException: Request method ‘GET‘ not...](https://blog.csdn.net/qq_44347175/article/details/125697957)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *3* [org.springframework.web.servlet-3.1.0.RELEASE](https://download.csdn.net/download/hankcyh/8361943)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
[ .reference_list ]
[org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'DELETE' not supported]
HTTP请求方法包括GET、POST、PUT、DELETE等,当我们使用SpringBoot编写Web应用程序时,我们需要在Controller中指定请求方法。如果我们使用了错误的请求方法,就会出现“org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'DELETE' not supported”这样的错误。这个错误表示我们使用了不支持的请求方法,例如在Controller中使用了@DeleteMapping注解,但是我们使用了GET或POST请求方法。要解决这个问题,我们需要检查我们的请求方法是否正确,并确保我们的Controller中使用的请求方法与我们的请求方法相匹配。