Announcement Announcement Module
Collapse
No announcement yet.
Aspect code not working - IllegalArgumentException Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Aspect code not working - IllegalArgumentException

    Hi All,
    I am new to AOP so apologies if this is trivial - but have done a search and tried a few things out and unfortunately no success.

    I'm getting the following exception:

    org.springframework.beans.BeanInstantiationExcepti on: Could not instantiate bean class [org.springframework.aop.aspectj.AspectJPointcutAdv isor]: Constructor threw exception; nested exception is java.lang.IllegalArgumentException: error at ::0 formal unbound in pointcut
    My xml config is:

    Code:
        <bean id="requestTimerAspect" class="com.monitor.RequestTimerAspect"/>
        <aop:config>
            <aop:aspect id="myAspect" ref="requestTimerAspect">
                <aop:pointcut id="myCutTimer"
                        expression="execution(* com.web.OpMonitorController.*())"/>
                <aop:around pointcut-ref="myCutTimer" method="timer"/>
            </aop:aspect>
        </aop:config>
    My aspect is:

    Code:
    package com.monitor;
    import org.aspectj.lang.ProceedingJoinPoint;
    
    public class RequestTimerAspect {
        public Object timer(ProceedingJoinPoint call) throws Throwable {
            System.out.println("before!");
            Object retVal = call.proceed();
            System.out.println("after!");
            return retVal;
        }
    }
    And my test method is:

    Code:
    package com.web;
    public class OpMonitorController {
        public void aspectTest(){
            System.out.println("Actually in the aspectTest method!!!!");
        }
    }
    Can anybody see where I've gone wrong?
    I have tried this with a couple of different expression values but no success yet, e.g:
    Code:
    expression="execution(* com.web.OpMonitorController.*(..))"
    Any help would be much appreciated,
    Thanks,
    Mark
Working...
X