Thinker.javajava.lang.IllegalArgumentException异常:在错误:: 0正式绑定在切入点
package springdemo2;
public interface Thinker {
void thinkOfSomething(String thoughts);
}
Volunteer.java
package springdemo2;
public class Volunteer implements Thinker{
private String thoughts;
@Override
public void thinkOfSomething(String thoughts) {
this.thoughts=thoughts;
}
public String getThoughts(){
return thoughts;
}
}
MindReader.java
package springdemo2;
public interface MindReader {
void interceptThoughts(String thoughts);
String getThoughts();
}
Magician.java
package springdemo2;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
@Aspect
public class Magician implements MindReader {
private String thoughts;
@Pointcut("execution(* springdemo2."
+ "Thinker.thinkOfSomething(String)) and args(thoughts)")
public void thinking(String thoughts){
}
@Override
@Before("thinking(thoughts)")
public void interceptThoughts(String thoughts) {
this.thoughts=thoughts;
System.out.println("Advice method intercepted Thoughts..."+thoughts);
}
@Override
public String getThoughts() {
return thoughts;
}
}
XML(春季)
我已经包含在我的XML文件<aop:aspectj-autoproxy/>
。
我得到了以下错误消息
java.lang.IllegalArgumentException: error at ::0 formal unbound in
pointcut
我简直不敢相信! '和'运算符在xml配置中有效,但不在注释版本中。谢谢! –