Search code examples
springaopspring-aoppointcut

Spring AOP pointcut is not well formed


Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.aop.aspectj.AspectJPointcutAdvisor#0': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.aop.aspectj.AspectJPointcutAdvisor]: Constructor threw exception; nested exception is java.lang.IllegalArgumentException: Pointcut is not well-formed: expecting 'name pattern' at character position 49 execution(*com.idol.performers.Performer.perform(..)

What is wrong with my pointcut? In book it says that

(..) // means taking any arguments

my xml:

 ...
<aop:before pointcut="execution(*com.idol.performers.Performer.perform(..))" method="takeSeats"/>
 ...

Solution

  • Try this:

    <aop:before pointcut="execution(* com.idol.performers.Performer.perform(..))" method="takeSeats"/>
    

    The issue is that you have no space between * and com.idol.performers.Performer.perform(..)