Results 1 to 2 of 2

Thread: AspectJ Pointcuts in Methods Injected by Roo Generated Aspects

  1. #1
    Join Date
    Feb 2011
    Posts
    2

    Default AspectJ Pointcuts in Methods Injected by Roo Generated Aspects

    Hello,

    I am trying to use custom aspects to wrap certain <Entity>.persist() methods as follows:

    TestAspect.java
    Code:
    package com.test.domain.util;
    
    import org.aspectj.lang.annotation.Aspect;
    import org.aspectj.lang.annotation.Before;
    
    @Aspect
    public class TestAspect {
    	@Before("com.test.domain.util.LegalEntity.persist()")
    	public void beforePersist() {
    		System.out.println("beforePersist()");
    	}
    }
    applicationContext.xml
    Code:
       <aop:aspectj-autoproxy/>
       <bean id="TestAspect1" class="com.xyrodian.resman.domain.util.TestAspect"/>
    However, when I try to build the project, it gives the error, "[ERROR] can't find referenced pointcut persist". How can I force it to process LegalEntity_Roo_Entity before TestAspect?

  2. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,629

    Default

    Check the error message and read the reference guide part about pointcuts again...

    You probably want the execute something before the execution of the persist method, currently you are referencing to a pointcut named persist in the LegalCompany class.

    Code:
    @Before("execution(* com.test.domain.util.LegalEntity.persist())")
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

Posting Permissions

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