I'm trying to insert (at first position) a simple custom Cors filter inside the spring filter chain.
If I do it like this
@Component
@Order(Ordered.HIGHEST_PRECEDENCE)
public class CorsFilter implements Filter {
it works perfectly I can verify it by putting a breakpoint in Spring's ServletHandler.java where there the line
chain=getFilterChain(baseRequest, target, servlet_holder);
I was just wondering if I wish not to use @Componenent and @Order
and instead defining the Filter bean the Application context.
How can I set the order of the filters ?