private List<String> excludePathPatterns = Arrays.asList( "/login/001", "/v2/api-docs", "/swagger-resources/**", "/swagger-ui.html", "/webjars/**", "/**/order" ); private List<String> checkPath = Arrays.asList( "/login/001", "/v2/api-docs", "/swagger-resources/xxx", "/swagger-ui.html", "/webjars/11213", "/xx/order" ); private boolean isExcluded(String requestURI) { for (String pattern : excludePathPatterns) { String regex = pattern.replace("**", ".*").replace("/*", "/[^/]*"); if (requestURI.matches(regex)) { return true; } } return false; } @Test public void testNam11e() { for (String excludePathPattern : checkPath) { boolean excluded = isExcluded(excludePathPattern); System.err.println(excluded); } }