在使用Springboot进行RESTFUL风格开发时需要将表单数据以其他请求提交。
直接在表单中添加
<input type="hidden" name="_method" value="delete"/>
再次提交时,依然是使用 POST 方法。
原因是在 Spring Boot 的 META-INF/spring-configuration-metadata.json 配置文件中默认是关闭 Spring 的 hiddenmethod 过滤器的。这时候需要通Springboot配置文件application.properties 中将 hiddenmethod 过滤器设置为启用即可。
spring.mvc.hiddenmethod.filter.enabled=true