8

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"/>
 ...
Lion
  • 18,729
  • 22
  • 80
  • 110
Aubergine
  • 5,862
  • 19
  • 66
  • 110

2 Answers2

13

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

nicholas.hauschild
  • 42,483
  • 9
  • 127
  • 120
  • Sometimes parsing errors can lead to obscure messages. In this case, it thought the `*` wildcard was a part of `com.idol.performers.Performer.perform`, meaning it was expecting that type as the return type, rather than just the `*`. Then it suggests that before it sees a '(', that it needs to have a 'name pattern' meaning the method name. That is why the space is necessary and that is really want it was trying to say, the best way that it could. – nicholas.hauschild Aug 20 '11 at 00:47
2

There should be space between * and com.idol.performers.Performer.perform(..)

Harika
  • 21
  • 1