What is the difference between /* and /** pattern in Spring boot?

后端 未结 3 1495
自闭症患者
自闭症患者 2021-02-14 14:50

I was trying to register certain URLs for a Filter when I noticed that there is a difference between /* and /** patte

3条回答
  •  无人及你
    2021-02-14 15:15

    Spring normally uses ant-style path matching patterns for URLs - if you look at the java docs for the AntPathMatcher you will see the explanation

    The mapping matches URLs using the following rules: ? matches one character
    * matches zero or more characters
    ** matches zero or more directories in a path 
    {spring:[a-z]+} matches the regexp [a-z]+ as a path variable named "spring"
    

    http://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/util/AntPathMatcher.html

提交回复
热议问题