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

Spring学习:AOP配置1(xml)

2017-04-19 08:38 323 查看
切面:aspect将一个bean作为切面类

切入点:pointcut

通知:Advice:有几种类型:before 、after-returning、after-throwing、after 、around

<aop:config>

        <aop:aspect id="moocAspectAOP" ref="aspectbean">

            <aop:pointcut id="moocpointcut" expression="execution(* aspect.biz.AspectBiz.*(..))" />

            

            <aop:before pointcut-ref="moocpointcut" method="before" />

            <aop:after-returning pointcut-ref="moocpointcut" method="after_returning" />

            <aop:after-throwing pointcut-ref="moocpointcut" method="after_throwing" />

            <aop:after pointcut-ref="moocpointcut" method="after" />

            <aop:around pointcut-ref="moocpointcut" method="around" />

        </aop:aspect>

    </aop:config>

1.必须在项目中导入aspectj-1.8.9.jar,aspectjweaver.jar,aspects.jar,否则会出现ClassNotFound异常
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: