applicationContext:
<?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-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd">
<aop:aspectj-autoproxy></aop:aspectj-autoproxy>
<bean id="interceptor" class="com.dcj.aop.Interceptor"/>
<aop:config>
<aop:pointcut expression="public * com.dcj.service..*.deleteUser(..)" id="logPointcut" />
<aop:aspect id="logAspect" ref="interceptor">
<aop:before method="before" pointcut-ref="logPointcut" />
</aop:aspect> </aop:config>
</beans>
编译出错 Class 'org.springframework.aop.aspectj.AspectJExpressionPointcut' not found
在aop:pointcut aop:before 这两行
jar包为 spring3.0 和aspectjweaver 和 aspectjrt
<?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-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd">
<aop:aspectj-autoproxy></aop:aspectj-autoproxy>
<bean id="interceptor" class="com.dcj.aop.Interceptor"/>
<aop:config>
<aop:pointcut expression="public * com.dcj.service..*.deleteUser(..)" id="logPointcut" />
<aop:aspect id="logAspect" ref="interceptor">
<aop:before method="before" pointcut-ref="logPointcut" />
</aop:aspect> </aop:config>
</beans>
编译出错 Class 'org.springframework.aop.aspectj.AspectJExpressionPointcut' not found
在aop:pointcut aop:before 这两行
jar包为 spring3.0 和aspectjweaver 和 aspectjrt
public void before() {
System.out.println("method start ---------");
} public void after() {
System.out.println("method end ---------");
} public Object around(ProceedingJoinPoint pjp) throws Throwable {
before();
Object retVal = pjp.proceed();
after();
return retVal;
}
}这是切面类 ,网上说如果传参数会出错 ,我这方法也没传参数啊。。
spring-aspects.jar