Announcement Announcement Module
Collapse
No announcement yet.
Spring AOP and method access restriction Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring AOP and method access restriction

    Hi ,

    I am using tracingbeforeadvice and tracingafteradvice for intercepting before and after a method .

    Is there any way that i can intercept my code at the starting of the method .

    Say my method is

    void foo()
    {
    //I want to intercept my code here......(here my security code
    //comes which restricts access to this method

    }


    Thanks in Advance ,

    Tom

  • #2
    I don't know if it's possible but you can intercept the method before it is executing:

    -->pointcut
    foo()

    It's the same as if the code is executed right away in your method (i.e.:
    foo()
    {
    -->pointcut
    }

    Comment


    • #3
      Thanks costin.

      Thanks Costin,


      If my TracingBeforeMethod is the same as the code included in method ,i have a code which will secure the method.I need to test it.

      Can I change the arguments passed to the method and the return value ?

      As the invocation in Advice provides me with (Object args) as an argument,Can I change it.?

      Thanks again.

      TOM

      Comment


      • #4
        Read the docs and you'll see the restrictions.
        AFAIK, depending on what type of interceptor you are using, you can change the objects (parameters passed to the method), the return type or skip the method invocation even.

        Comment

        Working...
        X