Spring boot SpringRESTRequestMethod如何映射http锁和解锁RequestMapping?

Spring boot SpringRESTRequestMethod如何映射http锁和解锁RequestMapping?,spring-boot,spring-restcontroller,spring-rest,spring-web,http-method,Spring Boot,Spring Restcontroller,Spring Rest,Spring Web,Http Method,看来这和 我需要使用http方法LOCK和UNLOCK实现一个调用 目前spring的requestMethod只支持 public enum RequestMethod { GET, HEAD, POST, PUT, PATCH, DELETE, OPTIONS, TRACE } 如果使用锁定和解锁http指令调用spring应用程序,如何实现调用的@RestController方法?您可以使用支持的方法(GET、HEAD、POST、PUT、PATCH、DELETE、OPTION

看来这和

我需要使用http方法LOCK和UNLOCK实现一个调用

目前spring的requestMethod只支持

public enum RequestMethod {

    GET, HEAD, POST, PUT, PATCH, DELETE, OPTIONS, TRACE

}

如果使用锁定和解锁http指令调用spring应用程序,如何实现调用的
@RestController
方法?

您可以使用支持的方法(GET、HEAD、POST、PUT、PATCH、DELETE、OPTIONS、TRACE)调用来实现。以下是在内部调用post方法的方法:

@配置
公共类WebMvcConfig扩展了WebMvcConfigurationSupport{
@凌驾
@豆子
公共请求映射HandlerAdapter请求映射HandlerAdapter(){
final RequestMappingHandlerAdapter RequestMappingHandlerAdapter=super.RequestMappingHandlerAdapter();
requestMappingHandlerAdapter.setSupportedMethods(
“锁定”、“获取”、“头部”、“发布”、“放置”、“修补”、“删除”、“选项”、“跟踪”
);//此处支持的方法
返回请求MappingHandlerAdapter;
}
@豆子
DispatcherServlet DispatcherServlet(){
返回新的CustomHttpMethods();
}
}
自定义方法处理程序类。这里是内部调用post方法:

公共类CustomHttpMethods扩展了DispatcherServlet{
@凌驾
受保护的无效服务(最终HttpServletRequest请求、最终HttpServletResponse响应)抛出ServletException、IOException{
if(“LOCK”.equals(request.getMethod())){
super.doPost(请求、响应);
}否则{
超级服务(请求、响应);
}
}
}
现在,您可以按以下方式进行请求映射:

@RequestMapping(value=“/custom”)
ResponseEntity customHttpMethod(){
返回ResponseEntity.ok().build();
}

现在在Spring Boot 2.2.6中实现此功能的新方法: