title: Spring Boot Security - antMatchers, regexMatchers
body: <p>In a REST controller on an endpoint path a trailing slash shall be allowed:</p>
  <pre><code>/path
  /path/
  </code></pre>
  <p>This is the default in a Spring Boot.</p>
  <p>With Spring Security basic authentication I would like to secure endpoints.</p>
  <p><code>antMatchers</code>:</p>
  <pre><code>.antMatchers(&quot;/path&quot;, &quot;/path/&quot;).hasRole(...)
  </code></pre>
  <p>Also with path variable like <code>{name}</code> it seems to be easy:</p>
  <pre><code>.antMatchers(&quot;/path/{name}&quot;, &quot;/path/{name}/&quot;).hasRole(...)
  </code></pre>
  <p>Not having to repeat because of the trailing slash I wanted to use instead</p>
  <p><code>regexMatchers</code>:</p>
  <pre><code>.regexMatchers(&quot;/path(/){0,1}&quot;.hasRole(...)
  </code></pre>
  <p>But how to use <code>regexMatchers</code> with path variable like for example <code>{name}</code>?</p>