您的位置:首页 > 编程语言 > Java开发

spring3.0 动态代理AOP

2011-04-11 16:23 323 查看
1.使用声明式AOP配置需要两个额外的jar包,aspectjweaver.jar和cglib-nodep-2.1_3.jar

2.配置文件:

<?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
">

<bean id="BeforeAdvice" class="com.BeforeAdvice"/><!--切面bean-->

<aop:config>
<aop:aspect ref="BeforeAdvice"> <!--引用切面bean-->
<aop:before method="before" pointcut="execution(* com.DataBasePlugin.*(..))"/> <!--定义切入点-->
</aop:aspect>
</aop:config>

</beans>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: