Search code examples
micronaut

Order of Execution of Multiple HttpServerFilters


If i have two HttpServerFilter implementations, one annotated with @Filter("/**") and another with @Filter("/abc/**"), how does micronaut handle this?

In my use case, I want micronaut to execute both and execute the filter with @Filter("/**") before @Filter("/abc/**"). Is there anyway to achieve this?


Solution

  • you needed to use the @Order annotation with @Filter you can give the order precedence as the parameter example

    @Ordered(Ordered.HIGHEST_PRECEDENCE)
    

    note that lower the value higher the precedence