在看视频学习springboot时,需要实现restfull风格的删除操作,以delete方式提交。
按照视频操作,直接在表单中添加:
<input type="hidden" name="_method" value="delete">
再次提交表单,发现依然是以post方式提交。
原因是:在2.2.6版本中,META-INF/spring-configuration-metadata.json配置文件中是默认关闭hiddenmethod过滤器的,
因此需要在主配置文件application.properties中开启:
spring.mvc.hiddenmethod.filter.enabled=true