Friday 15 March 2013

Java interceptor priority -



Java interceptor priority -

this might trivial question many of swear couldn't find reply anywhere else:

let's have class this

@interceptors(interceptor1.class) class myclass { @interceptors({interceptor2.class, interceptors3.class}) public void mymethod() {...} }

when mymethod called interceptors executed , in order?

interceptor2, interceptor3 or interceptor1, interceptor2, interceptor3 or interceptor2, interceptor3, interceptor1?

thanks in advance

quoting documentation

by default ordering of interceptors when invoking method are

external interceptors

default interceptors, if present

class interceptors, if present

method interceptors, if present

interceptor method on bean class (using @aroundinvoke)

within each grouping (default, class, method) order of interceptors left right defined in @interceptors annotation, , xml interceptors.

java java-ee annotations interceptor

No comments:

Post a Comment