Spring-AntPathMatcher

8次阅读

共计 246 个字符,预计需要花费 1 分钟才能阅读完成。

介绍
AntPathMatcher 是路径匹配规则工具类
规则

? 匹配一个字符(除过操作系统默认的文件分隔符)
* 匹配 0 个或多个字符
** 匹配 0 个或多个目录
{spring:[a-z]+} 将正则表达式 [a-z]+ 匹配到的值, 赋值给名为 spring 的路径变量.

案例
AntPathMatcher antPathMatcher = new AntPathMatcher();
System.out.println(antPathMatcher.match(“/get/{id}.json”,”/get/1.json”));

正文完
 0