AOP始终无法插入方法,求解。
package service;public class GoShopping {
public void buy(){
System.out.println("I buy a Sennheiser's HD555");
}
}package aop;import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;@Aspect
public class LogInterceptor {
@Before("execution(public void service.GoShopping.buy())")
public void before(){
System.out.println("method star");
}
}<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">
<context:annotation-config/>
<aop:aspectj-autoproxy/>
<bean name="goShopping" class="service.GoShopping"></bean>
</beans>
package service;public class GoShopping {
public void buy(){
System.out.println("I buy a Sennheiser's HD555");
}
}package aop;import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;@Aspect
public class LogInterceptor {
@Before("execution(public void service.GoShopping.buy())")
public void before(){
System.out.println("method star");
}
}<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">
<context:annotation-config/>
<aop:aspectj-autoproxy/>
<bean name="goShopping" class="service.GoShopping"></bean>
</beans>
commons.jar
aspectjrt.jar
aspectjweaver.jar还缺了什么吗?