-
Notifications
You must be signed in to change notification settings - Fork 41.5k
Closed
Description
We've defined our custom filters (javax.servlet.Filter
) through @Bean
s in a @Configuration
class. Something like:
@Configuration
public class MyWebMvcConfigurer implements WebMvcConfigurer {
...
@Bean @Order(200)
public Filter1 filter1() {
return new Filter1();
}
@Bean @Order(100)
public Filter2 filter2() {
return new Filter2();
}
...
}
However, the filters are being called in the order they appear in the code (Filter1 then Filter2) instead of the order defined by the annotations (Filter2 then Filter1). For other types of objects (non javax.servlet.Filter
) the @Order
s are being respected when the beans are injected.
If we define the filter and their ordering using @Component
+ @Order
on the filter classes themselves or via @Bean
s of type FilterRegistrationBean
+ FilterRegistrationBean.setOrder()
then the order is respected.
Is this anything specific to filters? Is this documented somewhere and we've missed that? Or is this an issue?
Metadata
Metadata
Assignees
Labels
type: documentationA documentation updateA documentation update