Announcement Announcement Module
Collapse
No announcement yet.
AspectJ Pointcuts in Methods Injected by Roo Generated Aspects Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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())")

    Comment

    Working...
    X