Spring: Difference of /** and /* with regards to paths

This is a path pattern that is used in Apache Ant library. Spring team implements it and uses it throughout the framework.


Back to your problem. According to the Javadoc for AntPathMatcher, it only has 3 rules:

  1. ? matches one character
  2. * matches zero or more characters
  3. ** matches zero or more ‘directories’ in a path

UPDATE 2022

In the latest Spring Framework versions there is a forth rule:

  1. {spring:[a-z]+} matches the regexp [a-z]+ as a path variable named “spring”

See the details in the latest (as of now) Spring Framework version 5 Javadoc: AntPathMathcer.

Leave a Comment