krishnakumarp
krishnakumarp

Reputation: 9295

Ordering of a spring @Bean filter

I have a filter (CorsFilter) that is configured using @Bean. This filter should run before LogoutFilter. I can do this by calling HttpSecurity.addFilterBefore(corsFilter, LogoutFilter.class) method in my implementation of ResourceServerConfigurerAdapter.configure(HttpSecurity http)

Can I achieve the effect of addFilterBefore just using annotation. Is there an @Before or something like that?

Spring Core 4.2.4
Spring Boot 1.3.1
Spring Security 4.0.2

Upvotes: 0

Views: 641

Answers (1)

Tom Van Rossom
Tom Van Rossom

Reputation: 1470

Yes you can: org.springframework.core.annotation.Order

Here is an example

Upvotes: 1

Related Questions