-
Nov 22nd, 2007, 02:51 PM
#1
BeanNameAutoProxyCreator, <aop:advisor/> and Ordered...
Hi,
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.
Thank you.
-
Nov 22nd, 2007, 03:05 PM
#2
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
#3
Now I'm using only <aop:config/> and it works.
Thank you!
About the order:
Am I right with this order?:
tx:annotation-driven: 1
AuditInterceptor: 2
SecurityInterceptor: 3
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
#4
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
#5
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
#6
Not sure what you want. Can you elaborate?
-
Nov 22nd, 2007, 05:24 PM
#7
I meant MethodInvocation#getThis().
Strange name...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules