I have created a spring boot filter - implements GenericFilterBean
with @Component
annotation.
@Component
public class MyAuthenticationFilter extends GenericFilterBean {
...
@Override
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
...
}
}
The filter is automatically identified by the Spring Boot Framework and works fine for all of the REST API. I want this filter to apply only on a certain URL path, such as /api/secure/*
but I can't find the right way.
I tried @WebFilter
but it didn't work.
I'm not using XML configuration or servlet initializer - just the annotations.
What would be the correct way to get it working?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…