作了一个权限管理系统,须要经过通配符来过滤请求url,在网上找了半天没有找到,后来想到spring自己就带有这个功能,经过查询最终找到了方法。使用该方法,须要引入spring-core包java
@Test public void regexSpringTest() { AntPathMatcher matcher = new AntPathMatcher(); String path = "/test/a/b"; String pattern = "/test/**"; boolean isMatch=matcher.match(pattern, path); logger.info("isMatch:{}", isMatch); }
注意:spring