Spring MVC URI路径匹配正则表达式

时间:2019-05-28 22:54:29

标签: spring spring-boot spring-mvc spring-restcontroller

我希望在后面的请求映射中匹配/some-slug-1234的映射,但是它说找不到映射。我在做什么错了?

@Controller
public class MyRequestHandlerController {

    @RequestMapping(value = "/[^/]+\\-[0-9]+", method = { RequestMethod.HEAD, RequestMethod.GET } )
    public void handleDocument(HttpServletRequest request, HttpServletResponse response){
      // render article
    }
 }

0 个答案:

没有答案