Spring里的Ant Pattern用於匹配URL
可以參考官網:https://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/util/AntPathMatcher.html
規則很簡單
? 匹配單個字符 * 匹配0個或者多個字符 ** 匹配0個或多個路徑(也就是用/分割的多級路徑) {spring:[a-z]+} 按照正則匹配[a-z]+,並且將其作為路徑變量,變量名為"spring"
舉例
com/t?st.jsp — matches com/test.jsp but also com/tast.jsp or com/txst.jsp com/*.jsp — matches all .jsp files in the com directory com/**/test.jsp — matches all test.jsp files underneath the com path org/springframework/**/*.jsp — matches all .jsp files underneath the org/springframework path org/**/servlet/bla.jsp — matches org/springframework/servlet/bla.jsp but also org/springframework/testing/servlet/bla.jsp and org/servlet/bla.jsp com/{filename:\\w+}.jsp will match com/test.jsp and assign the value test to the filename variable