Announcement Announcement Module
No announcement yet.
Getting a Pointcut inside a BeanPostProcessor Page Title Module
Move Remove Collapse
Conversation Detail Module
  • 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?!


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

      public void invoke() {

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

      appreciate your help! Thanks.


      • #4
        Fixed it!

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


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