Announcement Announcement Module
Collapse
No announcement yet.
Spring Aspect shown as advices but never invoked Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring Aspect shown as advices but never invoked

    Hi,

    I've a abstract DaoImpl class with a method
    Code:
    public List<T> matching(Criterion...filters)
    and another @Repository which implements the DaoImpl class. Now I'm creating an aspect as
    Code:
    @Around("execution(* com.mycompany.myproduct.dao.impl.FieldDefinitionDaoImpl.matching(..))")
    	public Object checkRestrictions(ProceedingJoinPoint point) throws Throwable
    In STS, it shows an indicator meaning that the point cut applied works on the intended method. But when I run a unit test, the aspect never gets executed. Also if I change the pointcut to
    Code:
    @Around("execution(* com.mycompany.myproduct.dao.impl.FieldDefinitionDaoImpl.*(..))")
    	public Object checkRestrictions(ProceedingJoinPoint point) throws Throwable
    , the aspect gets executed. I tried with this pointcut which I originally wanted but gave up after lots of trying because the aspect won't execute.

    Code:
    @Around("execution(* com.mycompany.myproduct.dao.impl.FieldDefinitionDaoImpl.matching(org.hibernate.criteria.Criterion...)) and args(criterions)")
    	public Object checkRestrictions(ProceedingJoinPoint point, Criterion...criterions) throws Throwable
    Please help

  • #2
    I never thought it'll take this long even here. Anyone? do you see any problems? How can I correct it?

    Comment


    • #3
      Now, it can't be happening....

      I mean, you guys must be knowing for sure......

      There's a execution PCD and it shows what it matches in STS and I can search it in Pointcut Matches....but it never gets invoked....

      It works when


      @Around("execution(* com.mycompany.myproduct.dao.impl.FieldDefinitionDa oImpl.*(..)))") public Object checkRestrictions(ProceedingJoinPoint point) throws Throwable
      There has to be some catch......Noone knows????????????????????????????????

      Comment


      • #4
        I could very well imagine that there's certain small thing which I'm missing.
        So Spring AOP doesn't support self-invocation.
        I'm sure, I'll remember this throughout my life.

        So anyone new to AOP, please make sure you understand this. I wasted two days cause I didn't go through the whole chapter in reference docs. My Bad.

        Comment

        Working...
        X