8.5.3 Ordering Interceptor Execution - Reference Documentation
Authors: Graeme Rocher, Peter Ledbrook, Marc Palmer, Jeff Brown, Luke Daley, Burt Beckwith, Lari Hotari
Version: 3.1.8
8.5.3 Ordering Interceptor Execution
Interceptors can be ordered by defining anorder
property that defines a priority.For example:class AuthInterceptor { int order = HIGHEST_PRECEDENCE …
}
order
property is 0.The values HIGHEST_PRECEDENCE
and LOWEST_PRECEDENCE
can be used to define filters that should should run first or last respectively.Note that if you write an interceptor that is to be used by others it is better increment or decrement the HIGHEST_PRECEDENCE
and LOWEST_PRECEDENCE
to allow other interceptors to be inserted before or after the interceptor you are authoring:int order = HIGHEST_PRECEDENCE + 50// orint order = LOWEST_PRECEDENCE - 50
logback.groovy
as follows:logger 'grails.artefact.Interceptor', DEBUG, ['STDOUT'], false
grails-app/conf/application.yml
:beans: authInterceptor: order: 50
grails-app/conf/application.groovy
:beans { authInterceptor { order = 50 } }