Announcement Announcement Module
Collapse
No announcement yet.
Getting a Pointcut inside a BeanPostProcessor Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Getting a Pointcut inside a BeanPostProcessor

    How can I get a reference to a Pointcut that was defined by AspectJ annotations?
    I need to do it programatically, inside a BeanPostProcessor and then check if the bean just created matches the pointcut.

    Any ideas?

  • #2
    Why?! Why not use an Aspect instead of a BeanPostProcessor?!

    Comment


    • #3
      Pointcut that doesn't get executed when a bean has a constructor with arguments!

      This is my sole objective. I need to have a pointcut that doesn't get executed when a bean/class being proxied has a constructor with arguments. Some of the old classes doesn't have interfaces hence I'm using CGLIB Proxy instead of dynamic proxy(Actually have both of them in place and using depending on the interface or class). My method pointcut looks like this.

      <code>
      @Pointcut("!execution(*.new(..))")
      public void invoke() {
      }
      </code>

      That didn't work. So I tried to implement BeanPostProcessor and tried like ziba tried..Couldn't figure out!

      appreciate your help! Thanks.

      Comment


      • #4
        Fixed it!

        Instead of !execution(*.new(..)) I tried
        execution(*.new()) and it worked.

        Comment


        • #5
          Need help on combined expressions!

          This is my expression

          @Pointcut("execution(*.new()) or execution( * *(..))) or !execution(* final(..) or !within(MyAdvisor) ")
          My advisor methods are not being called now. If I remove the first part "execution(*.new())" or switch the order and bring "execution( * *(..)))" to the front it works but breaks my other intention of avoiding constructors with arguments. Basically, it seems to ignore the rest of it.

          Could someone shed light on this pls? Thanks.

          Comment

          Working...
          X