PathMatcher matcher = new AntPathMatcher() 路径匹配用法

基于正则表达式匹配路径。

import org.springframework.util.AntPathMatcher;
import org.springframework.util.PathMatcher;

PathMatcher matcher = new AntPathMatcher();
matcher.match("/**/login/**", uri)

实例:

System.out.println(matcher.match("/login/**", "/login/into"));

true
System.out.println(matcher.match("/**/login/**", "/login/into"));

true
System.out.println(matcher.match("/**/login/**", "/xxx/login/into"));

true
System.out.println(matcher.match("/login/**", "/xxx/login"));

false

反正和那些登录拦截器的拦截方式一样

你可能感兴趣的:(java技术,java)