Reputation: 7249
I have a class like this
@WebFilter(urlPatterns={"/message/*","/private_message"})
@Component
public class TokenAuthenticationFilter extends FilterRegistrationBean {
and I thought that Spring Boot would respect the urlPatterns setted, but for some reason, every request gets to this filter. I think I may be doing something wrong.
Also, I'm not using Spring Security
Upvotes: 3
Views: 1772
Reputation: 116111
You're mixing use of @WebFilter
and FilterRegistrationBean
. The former should be used on a class that is a Filter
and in conjunction with @ServletComponentScan
. The latter should be published as a bean (as you are doing by annotating with @Component
) and the url mappings configured using its setUrlPatterns
method.
Upvotes: 4