Points To Remember

From Spring boot version you can define the order of your filters by defining order for your filters using @Order annotation.
You can use @Order annotation as follows to make a filter to be first in the filter chain.

@Order(1)

How to define Filter order in Filter Chain in Spring Boot

Following is the example where we have registered two filters

  • Security Filter - To block unauthorized requests
  • Tracking Filter - To log each request coming to the server

###### security filter
###### tracking filter