Announcement Announcement Module
No announcement yet.
BeanNameAutoProxyCreator, <aop:advisor/> and Ordered... Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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.

    Thank you.

  • #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...


    • #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.


      • #4
        You're welcome, I'm glad it works.

        The order depends on your needs, judging by your description it looks fine.


        • #5
          One question about the MethodInterceptor.
          Is there a way how I can find out, what the target object is?


          • #6
            Not sure what you want. Can you elaborate?


            • #7
              I meant MethodInvocation#getThis().
              Strange name...