Spring Security: How to use multiple URL patterns in FilterRegistrationBean? : <p>I have a bean</p>

<pre><code>@Bean
public FilterRegistrationBean animalsFilterRegistration() {
    FilterRegistrationBean registration = new FilterRegistrationBean();
    registration.setFilter(new AnimalsFilter());
    registration.addUrlPatterns(
        "/api/cat",
        "/api/cat/**",
        "/api/dog"
    );
    ...
    return registration;
}
</code></pre>

<p>In that bean, I use two patterns for <code>/api/cat**</code> URLs. The problem is that when I try to call endpoints with complex postfix (<code>/api/cat/1/feed</code>), my filter does not intercept the request. But it's OK when I call <code>/api/cat</code> and <code>/api/got</code> endpoints -- filter works as expected and intercepts requests. </p>

<p>How can I use multiple URL patterns for my case (<code>/api/cat</code>, <code>/api/cat/**</code>)?</p>

<p><em>PS</em></p>

<p>I have tried to use next pattern combinations:</p>

<pre><code>1) /api/cat, /api/cat**, /api/dog
2) /api/cat, /api/cat/**, /api/dog
3) /api/cat**, /api/dog
</code></pre>
