Nov 22nd, 2007, 02:51 PM
BeanNameAutoProxyCreator, <aop:advisor/> and Ordered...
I have a SecurityMethodInterceptor which is called by a BeanNameAutoProxyCreator.
And I have an AuditInterceptor (simple MethodInterceptor) which I have configured via an <aop:advisor/> element.
Both implements the Ordered interface.
The strange thing is, that my order properties have no effect on the order of the execution of the interceptors.
getOrder() is never called and so it is clear that this property has no effect.
Is this a bug? I'm using Spring 2.0.5 and acegi 1.0.3.
Nov 22nd, 2007, 03:05 PM
It isn't a bug it is a result of your configuration.
You have 2 proxy mechanisms each creates a proxy, so the order is based on the proxy creator. Either use a BeanNameAutoProxyCreator for all your aop/proxy stuff or use an aop block for everything. I suggest the latter...
Nov 22nd, 2007, 04:45 PM
Now I'm using only <aop:config/> and it works.
About the order:
Am I right with this order?:
This should ensure that a transaction is always in place and any exception thrown by my SecurityInterceptor goes always through my AuditInterceptor.
Nov 22nd, 2007, 05:04 PM
You're welcome, I'm glad it works.
The order depends on your needs, judging by your description it looks fine.
Nov 22nd, 2007, 05:14 PM
One question about the MethodInterceptor.
Is there a way how I can find out, what the target object is?
Nov 22nd, 2007, 05:19 PM
Not sure what you want. Can you elaborate?
Nov 22nd, 2007, 05:24 PM
I meant MethodInvocation#getThis().