Spring AOP pointcut is not well formed

Aubergine picture Aubergine · Aug 20, 2011 · Viewed 11.9k times · Source

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"/>
 ...

Answer

nicholas.hauschild picture nicholas.hauschild · Aug 20, 2011

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(..)