Announcement Announcement Module
Collapse
No announcement yet.
Mark Fisher's Example of AOP Interception in 2.1M2 Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Mark Fisher's Example of AOP Interception in 2.1M2

    Hi

    I discover Mark's Fisher blog on Annotation-Driven Dependency Injection in Spring 2.1 http://blog.interface21.com/main/200...-in-spring-21/.

    Everything works except for Step 10 with the service invocation logger. The AOP does not seem to work here although it makes sense. This is the class

    /*
    * Created on 19 Jul 2007 by Peter A. Pilgrim
    */
    package blog;

    import org.aspectj.lang.annotation.Aspect;
    import org.aspectj.lang.annotation.Before;
    import org.aspectj.lang.annotation.Pointcut;

    @Aspect
    public class ServiceInvocationLogger {

    private int invocationCount;

    @Pointcut("execution(* blog.*Service+.*(..))")
    public void serviceInvocation() {}

    @Before("serviceInvocation()")
    public void log() {
    invocationCount++;
    System.out.println("service invocation #" + invocationCount);
    }
    }

Working...
X