Spring路径匹配器的使用方法
1.创建AntPathMatcher对象
//路径匹配器
public static final AntPathMatcher PATH_MATCHER = new AntPathMatcher();
2.使用方法,match来逐个对比路径是否匹配,如果有匹配的则返回true,没有则false
public boolean check(String requestUrI,String[] urls){
for (String url : urls) {
if (PATH_MATCHER.match(url,requestUrI)) {
return true;
}
}
return false;
}