AOP中Advisor和Aspect之间有什么区别? [英] What is the difference between Advisor and Aspect in AOP?

查看:548
本文介绍了AOP中Advisor和Aspect之间有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Spring AOP的新手。根据我的理解,我注意到Advisor(例如 DefaultPointcutAdvisor )和Aspect(例如用 @Aspect )可以通过在调用方法时做更多事情来帮助解决交叉问题。

I am new to Spring AOP. Based on my understanding, I noticed that both Advisor (for example DefaultPointcutAdvisor) and Aspect (for example the class annotated with @Aspect) can both help to solve the cross-cutting problem by doing something more when a method is invoked.

这两个术语有什么不同?

What is the different between these two term please?

推荐答案

建议是您对<$ c $采取行动的方式C>切入点。您可以在建议之前,之后或甚至周围使用以应用您定义的任何操作。谈到Spring Aspect ,它只是一个高级别的类并合并两个概念: jointpoint 建议。它可以通过基于XML的蓝图或以编程方式完成。另外,您应该指定要插入方面的点,使用 Jointpoint 来完成。

Advice is the way you take an action on your Pointcut. You can use before, after or even around advice to apply any action you defined. Talking about Spring Aspect, it is only a class which is a high level and merge two concepts : jointpoint and advice. It can be done through XML based blueprint, or programmatically. Also you should specify your point where you want to plug in an aspect, it is done by using Jointpoint.

此外,春天方面建议不是替代品对于彼此,因为Aspects只是联合点和建议的合并。

Also Spring Aspects and Advice aren't substitute for each other, because Aspects is only merger for jointpoint and advice.

这篇关于AOP中Advisor和Aspect之间有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆