34

I am learning spring-boot and for my brain, in order to accept some things, it needs to find a meaningful explanation of those things. Could anybody tell me what "ant" in "antMatchers" means? What has an insect like an "ant" got to do with the mapping between a resource and the path of the REST-call?

I know that this is not a language research forum, but I think that developers have also the right to understand or refuse logical/illogical things.

Thank you ;)

Peter Hall
  • 53,120
  • 14
  • 139
  • 204
NicDD4711
  • 453
  • 4
  • 7

2 Answers2

39

It comes from Apache Ant Project, which is a java build system that utilises an xml scripting language. Here is the website Apache Ant Home and in Spring Doc for AntPathMatcher it says "Part of this mapping code has been kindly borrowed from Apache Ant." So "antMatchers" means an implementation of Ant-style path patterns in mappings.

Software Engineer
  • 15,457
  • 7
  • 74
  • 102
javasenior
  • 1,786
  • 2
  • 22
  • 26
29

The term comes from the archaic build system, Apache Ant. In Ant paths were matched against a simple pattern containing * symbols meaning any string, and ** meaning 'recursive' descending any number of directories/folders. So, an ant-matcher like this: /a/b/*/d/**/z could match: /a/b/w/d/x/y/z because the w bit is matched by * and the /x/y/ bit is matched by **.

Software Engineer
  • 15,457
  • 7
  • 74
  • 102
  • Thanks @Engineer Dollery. Now is my live more supportable :) – NicDD4711 Apr 19 '17 at 08:50
  • documentation supports this answer https://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/util/AntPathMatcher.html – Gel Oct 31 '18 at 04:31