Announcement Announcement Module
No announcement yet.
Confused about the pointcut expression. Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Confused about the pointcut expression.


    I am a bit confused about the pointcut expression.

    I have the following aop.xml

    	    <include within="org.gng.jbc.model.*"/>
    	    <include within="org.crank.crud.*"/>
    	    <include within="org.gng.jbc.dao.*"/>
    	    <aspect name="org.gng.jbc.advice.EncodePassword"/> 
    	    <aspect name="org.gng.jbc.advice.SetOwner"/> 
    	    <concrete-aspect name="org.gng.jbc.advice.ApplicationTraceAspect" 
    	    	<pointcut name="traced"
    	    		      expression="call(public * org.crank.crud.GenericDao.*(..))"/>
    where org.crank.crud.GenericDao is an Interface. Using this form, I failed to capture any thing.

    but if I replace org.crank.crud.GenericDao with org.crank.crud.GenericDaoJpa
    which is the actual class, I can see the capturing.

  • #2
    How are you actually calling your DAO in your application? Through an object of the interface type GenericDao, or through an object of the concrete type GenericDaoJpa? call() pointcut type matching works a bit differently than execution(), as described here:

    Also, have you tried adding the subtype matching operator to your expression? For example:

    call(public * org.crank.crud.GenericDao+.*(..))


    • #3
      thanks for the help.

      through an object which is created by the ProxyFactoryBean having the GenericDao interface. The actual bean carrying out the operation is created by the ProxyFactoryBean which is instance of GenericDaoJpa.

      I have tried GenericDao+.* or GenericDao*.* and both doesn't work. In fact I would say it not work all the time but that the capture is very different.

      I need to be very specific

      "execution(public * org.crank.crud.GenericDaoJpa.*(..))" to get the expected behaviour.

      Another very strange thing is that a @before advice and a @around advice would show different result, even using the same pointcut expression.

      That is why I said I am confused.