Fork me on Gitee

Spring Boot Request method DELETE not supported

1: 开启HiddenHttpMethodFilter

最新版本的spring boot 默认不开启 restful 分割api

    @Bean
    @ConditionalOnMissingBean({HiddenHttpMethodFilter.class})
    @ConditionalOnProperty(
        prefix = "spring.mvc.hiddenmethod.filter",
        name = {"enabled"},
        matchIfMissing = false
    )

开启办法:

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

 

通过使用隐藏域参数来

th:attr="del_uri=@{/emp/}+${emp.id}"

当然也可以使用传统POST 来做处理 , 在from里面多做几个参数

 

推荐使用 Ajax ,直接支持delete请求 不过需要浏览器支持

posted @ 2019-12-03 14:37  ---dgw博客  阅读(3032)  评论(0编辑  收藏  举报