0
java 8, spring 4.3 및 apsectj 1.8.9를 사용하고 있습니다. 아래 코드에서 아래 오류가 발생합니다. @Before ("com. beans.Student.addCustomer() ") 포인트 컷없이 0이 오류가 발생하여 참조 된 pointcut을 찾을 수 없습니다. poincut으로 @Before를 사용할 때 오류가 발생하지 않습니다.0에서 봄 AOP 오류가 참조 된 pointcut을 찾을 수 없습니다.
콩 :
@Aspect
public class Beforeaspect {
/*
* @Pointcut("execution(* com.beans.Student.addCustomer(..))") public void
* log(){
* }
*/
// @Before("log()")
@Before("com.beans.Student.addCustomer()")
public void logBefore(JoinPoint jp) {
System.out.println("logbefore");
System.out.println("method " + jp.getSignature().getName());
}
}
학생 :
package com.beans;
public class Student implements Studentimpl {
public void addCustomer() {
System.out.println("addcustomer");
}
public String addCustomername(String stud) {
System.out.println("addcustomername");
return "hello";
}
}
봄 XML 파일 :
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">
<aop:aspectj-autoproxy />
<bean id="stud" class="com.beans.Student" />
<bean class="com.beans.Beforeaspect" />
</beans>
감사 니콜라스을, 나는 * (com.beans을 belowpublic 클래스 학생 { \t @Pointcut ("실행을 추가하는 것을 잊었다. Student.addCustomers (...)) ") \t AddCustomer와 공극() { \t \t \t }} –