public static void main(String[] args) {
String matchUrl = "/api/**";
String url = "/api/ams/list";
boolean flag = match(matchUrl, url);
System.out.println(flag);
}
private static PathMatcher matcher = new AntPathMatcher();
public static boolean match(String patternPath, String requestPath) {
if (StringUtil.isEmpty(patternPath) || StringUtil.isEmpty(requestPath)) {
return false;
}
return matcher.match(patternPath, requestPath);
}
Spring url正则匹配实现
最新推荐文章于 2024-07-12 00:56:09 发布