title: Spring Boot filter pattern matches wrong urls
body: <p>I am working on a Spring Boot web application. It contains the following configuration class:</p>
  
  <pre class="lang-java prettyprint-override"><code>@Configuration
  public class FilterRegistration {
  
      @Bean
      public FilterRegistrationBean provideTestFilter() {
          final FilterRegistrationBean registrationBean = new FilterRegistrationBean();
          registrationBean.setFilter(new OncePerRequestFilter() {
              @Override
              protected void doFilterInternal(final HttpServletRequest request, final HttpServletResponse response, final FilterChain filterChain) throws ServletException, IOException {
                  throw new RuntimeException("I shouldn't be thrown!");
              }
          });
          registrationBean.addUrlPatterns("/users/*");
          return registrationBean;
      }
  
  }
  </code></pre>
  
  <p>I can tell that the filter was registered successfully, because, during startup, the console logs the following entry:</p>
  
  <pre><code>o.s.b.c.embedded.FilterRegistrationBean  : Mapping filter: 'oncePerRequestFilter' to urls: [/users/*]
  </code></pre>
  
  <p>When I test the endpoints, I get the following results:</p>
  
  <p><code>curl localhost:8080/users/bob</code> -> <code>{"status": 500, "message": "I shouldn't be thrown!"}</code></p>
  
  <p><code>curl localhost:8080/users/</code> -> <code>{"status": 500, "message": "I shouldn't be thrown!"}</code></p>
  
  <p><code>curl localhost:8080/users</code> -> <code>{"status": 500, "message": "I shouldn't be thrown!"}</code></p>
  
  <p><code>curl localhost:8080/usersx</code> -> <code>{"status": 404, "error": "Not Found"}</code></p>
  
  <p>The first and last results are expected, but why does the url pattern <code>/users/*</code> match the urls <code>/users/</code> and <code>/users</code> as well?</p>
  
  <p>Is there a different syntax for Spring url patterns to <strong>_not_</strong> match these two urls, and only match <code>/users/bob</code>, <code>/users/alice</code> or <code>/users/any_non_empty_string</code>?</p>