spring boot2 restful 配置

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_37059838/article/details/85090501

Post增(查询参数多是也用post) Delete删   Put改    get查

springboot配置默认拦截controller(自定义配置不会过滤css,js)

spring
#restful风格配置
mvc:
  hiddenmethod:
    filter:
      enabled: true

js  使用put delete 都为 type都为post 

controller为 

@DeleteMapping("delete") 
@PutMapping("update")
$.ajax({
                url: '/hot/delete',
                type: 'post',
                dataType: 'JSON',
                data: {
                    id:id,
                    _method: 'delete'
                }
            });

另一种为页面在表单里

<input type="hidden" name="_method" value="put"/>

猜你喜欢

转载自blog.csdn.net/qq_37059838/article/details/85090501