Spring学习:AOP配置1(xml)

来源:互联网 发布:根据ip查询域名 编辑:程序博客网 时间:2024/06/07 10:00

切面: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异常


0 0
原创粉丝点击