作了一個權限管理系統,須要經過通配符來過濾請求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