spring拦截器同名路径匹配问题

在spring拦截器中,使用mapping和exclude-mapping可以匹配url路径。


我遇到的问题是,我写了几个restful接口,他们的路径名称相同,请求方式不同,这该如何匹配呢?比如所,我要拦截post、put、delete方法,不拦截get方法,应该如何设置?


举个更具体的例子,PostMapping("/student")和GetMapping("/student"),我在拦截器中只想拦截Post方法不想拦截get方法,怎么处理?

@RequestMapping(value = "/{bizId}", method = RequestMethod.GET) 请求路径加上method。其它请求方式都有对应的

可以在filter中通过HttpServletRequest的getMethod()方法去获得具体是post 还是get请求