Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to define / configure priority for multiple aspects using Spring AOP (or AspectJ)

I have been able to define multiple aspects (one is @Before and another is @Around) using Spring AOP (combined with AspectJ annotations) over a business service class.

Currently they are getting called one by one (in sequence). However I would like to know how the priority of calling the aspects can be defined and where.

Please guide me with respect to Spring AOP. Please note that I am using Spring 2.5.3 framework.

like image 907
jatanp Avatar asked Sep 24 '08 07:09

jatanp


1 Answers

I found the answer to this problem.

One can use @Order annotation to specify the order / sequence for particular Aspect class (the class annotated with @Aspect).

Or the aspect class can implement org.springframework.core.Ordered interface to provide order value to Spring framework.

like image 50
jatanp Avatar answered Sep 28 '22 03:09

jatanp