springboot项目中以 PUT 方法提交表单数据,@DeleteMapping请求时出错,页面显示Request method ‘POST’ not supported
原因是 Spring 的 hiddenmethod 过滤器默认是关闭的,在表单提交的数据中 "_method" 数据并不起作用。解决方法:
application.properties中将 hiddenmethod 过滤器设置为启用即可
#启用hiddenMethod过滤器
spring.mvc.hiddenmethod.filter.enabled = true