Results 1 to 4 of 4

Thread: Spring Aspect shown as advices but never invoked

  1. #1
    Join Date
    Dec 2009
    Location
    India
    Posts
    108

    Unhappy 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. #2
    Join Date
    Dec 2009
    Location
    India
    Posts
    108

    Angry

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

  3. #3
    Join Date
    Dec 2009
    Location
    India
    Posts
    108

    Default

    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????????????????????????????????

  4. #4
    Join Date
    Dec 2009
    Location
    India
    Posts
    108

    Default

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •