解决springboot项目@DeleteMapping请求出错,页面显示Request method ‘POST‘ not supported的方法

springboot项目中以 PUT 方法提交表单数据,@DeleteMapping请求时出错,页面显示Request method ‘POST’ not supported

原因是 Spring 的 hiddenmethod 过滤器默认是关闭的,在表单提交的数据中 "_method" 数据并不起作用。解决方法:

application.properties中将 hiddenmethod 过滤器设置为启用即可

#启用hiddenMethod过滤器
spring.mvc.hiddenmethod.filter.enabled = true


版权声明:本文为netsram原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。