问题描述
我是Spring AOP的新手。根据我的理解,我注意到Advisor(例如 DefaultPointcutAdvisor
)和Aspect(例如用 @Aspect $ c $注释的类) c>)可以通过在调用方法时做更多事情来帮助解决交叉问题。
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之间有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!