Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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"/>
 ...
like image 309
Aubergine Avatar asked Aug 20 '11 00:08

Aubergine


People also ask

What is pointcut in Spring AOP?

In Spring AOP, a join point always represents a method execution. A pointcut is a predicate that matches the join points, and the pointcut expression language is a way of describing pointcuts programmatically.

What is the difference between JoinPoint and pointcut?

JoinPoint: Joinpoint are points in your program execution where flow of execution got changed like Exception catching, Calling other method. PointCut: PointCut are basically those Joinpoints where you can put your advice(or call aspect). So basically PointCuts are the subset of JoinPoints.

What is pointcut in AspectJ?

AspectJ provides primitive pointcuts that capture join points at these times. These pointcuts use the dynamic types of their objects to pick out join points. They may also be used to expose the objects used for discrimination. this(Type or Id) target(Type or Id)


1 Answers

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

like image 191
nicholas.hauschild Avatar answered Sep 21 '22 17:09

nicholas.hauschild