配置切入点表达式要注意的细节

配置切入点表达式要注意的细节
<aop:config>
        <!--配置切入点表达式,此标签写在aop:aspect标签内部只能当前标签使用,-->
        <aop:pointcut id="pt1" expression="execution(* com.itheima.service.impl.*.*(..))"></aop:pointcut>
        <aop:aspect id="logAdvice" ref="logger">
            <aop:before method="beforePrintLog" pointcut-ref="pt1"></aop:before>

            <aop:after-returning method="afterRuturnPrintLog" pointcut-ref="pt1"></aop:after-returning>

            <aop:after-throwing method="afterThrowingPrintLog" pointcut-ref="pt1"></aop:after-throwing>

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


        </aop:aspect>
    </aop:config>

注意下面这句话如果放在aop:aspect外面,只能放在其上面(xml约束问题)
<!--配置切入点表达式,此标签写在aop:aspect标签内部只能当前标签使用,-->
        <aop:pointcut id="pt1" expression="execution(* com.itheima.service.impl.*.*(..))"></aop:pointcut>

全部评论

相关推荐

嵌入式小辣鸡:包装好一点,校内的奖项可以不用写,校内项目经历最后两点写的太差了,详细讲一下内容,名字变一下。只需要写项目实现了什么,自己在其中做了什么就好,查看图片
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务